summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2016-12-09 19:28:48 +0100
committerBram Moolenaar <Bram@vim.org>2016-12-09 19:28:48 +0100
commit6270660611a151c5d0f614a5f0248ccdc80ed971 (patch)
tree407a24e99176ba9a223a15f27f7d89ba14f5f8d0 /src
parenteaaa9bbda6ec0a8589a9b23720f95bffe01dc267 (diff)
downloadvim-6270660611a151c5d0f614a5f0248ccdc80ed971.zip
patch 8.0.0126
Problem: Display problem with 'foldcolumn' and a wide character. (esiegerman) Solution: Don't use "extra" but an allocated buffer. (Christian Brabandt, closes #1310)
Diffstat (limited to 'src')
-rw-r--r--src/Makefile1
-rw-r--r--src/screen.c20
-rw-r--r--src/testdir/Make_all.mak1
-rw-r--r--src/testdir/test_display.vim37
-rw-r--r--src/version.c2
5 files changed, 54 insertions, 7 deletions
diff --git a/src/Makefile b/src/Makefile
index a24eb7b72..dcd59fc67 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -2085,6 +2085,7 @@ test_arglist \
test_delete \
test_diffmode \
test_digraph \
+ test_display \
test_ex_undo \
test_execute_func \
test_expand \
diff --git a/src/screen.c b/src/screen.c
index 45e7c7c19..ee61a01ae 100644
--- a/src/screen.c
+++ b/src/screen.c
@@ -3649,13 +3649,19 @@ win_line(
draw_state = WL_FOLD;
if (fdc > 0)
{
- /* Draw the 'foldcolumn'. */
- fill_foldcolumn(extra, wp, FALSE, lnum);
- n_extra = fdc;
- p_extra = extra;
- p_extra[n_extra] = NUL;
- c_extra = NUL;
- char_attr = hl_attr(HLF_FC);
+ /* Draw the 'foldcolumn'. Allocate a buffer, "extra" may
+ * already be in used. */
+ p_extra_free = alloc(12 + 1);
+
+ if (p_extra_free != NULL)
+ {
+ fill_foldcolumn(p_extra_free, wp, FALSE, lnum);
+ n_extra = fdc;
+ p_extra_free[n_extra] = NUL;
+ p_extra = p_extra_free;
+ c_extra = NUL;
+ char_attr = hl_attr(HLF_FC);
+ }
}
}
#endif
diff --git a/src/testdir/Make_all.mak b/src/testdir/Make_all.mak
index 17c70f345..c78e34bd8 100644
--- a/src/testdir/Make_all.mak
+++ b/src/testdir/Make_all.mak
@@ -148,6 +148,7 @@ NEW_TESTS = test_arglist.res \
test_cscope.res \
test_diffmode.res \
test_digraph.res \
+ test_display.res \
test_farsi.res \
test_fnameescape.res \
test_gf.res \
diff --git a/src/testdir/test_display.vim b/src/testdir/test_display.vim
new file mode 100644
index 000000000..ba7b7d762
--- /dev/null
+++ b/src/testdir/test_display.vim
@@ -0,0 +1,37 @@
+" Test for displaying stuff
+if !has('gui_running') && has('unix')
+ set term=ansi
+endif
+
+function! s:screenline(lnum, nr) abort
+ let line = []
+ for j in range(a:nr)
+ for c in range(1, winwidth(0))
+ call add(line, nr2char(screenchar(a:lnum+j, c)))
+ endfor
+ call add(line, "\n")
+ endfor
+ return join(line, '')
+endfunction
+
+function! Test_display_foldcolumn()
+ new
+ vnew
+ vert resize 25
+
+ 1put='e more noise blah blah‚ more stuff here'
+
+ let expect = "e more noise blah blah<82\n> more stuff here \n"
+
+ call cursor(2, 1)
+ norm! zt
+ redraw!
+ call assert_equal(expect, s:screenline(1,2))
+ set fdc=2
+ redraw!
+ let expect = " e more noise blah blah<\n 82> more stuff here \n"
+ call assert_equal(expect, s:screenline(1,2))
+
+ quit!
+ quit!
+endfunction
diff --git a/src/version.c b/src/version.c
index afc79d473..3cd19f177 100644
--- a/src/version.c
+++ b/src/version.c
@@ -765,6 +765,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 126,
+/**/
125,
/**/
124,