Skip to content

Commit 6270660

Browse files
committed
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)
1 parent eaaa9bb commit 6270660

File tree

5 files changed

+54
-7
lines changed

5 files changed

+54
-7
lines changed

src/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2085,6 +2085,7 @@ test_arglist \
20852085
test_delete \
20862086
test_diffmode \
20872087
test_digraph \
2088+
test_display \
20882089
test_ex_undo \
20892090
test_execute_func \
20902091
test_expand \

src/screen.c

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3649,13 +3649,19 @@ win_line(
36493649
draw_state = WL_FOLD;
36503650
if (fdc > 0)
36513651
{
3652-
/* Draw the 'foldcolumn'. */
3653-
fill_foldcolumn(extra, wp, FALSE, lnum);
3654-
n_extra = fdc;
3655-
p_extra = extra;
3656-
p_extra[n_extra] = NUL;
3657-
c_extra = NUL;
3658-
char_attr = hl_attr(HLF_FC);
3652+
/* Draw the 'foldcolumn'. Allocate a buffer, "extra" may
3653+
* already be in used. */
3654+
p_extra_free = alloc(12 + 1);
3655+
3656+
if (p_extra_free != NULL)
3657+
{
3658+
fill_foldcolumn(p_extra_free, wp, FALSE, lnum);
3659+
n_extra = fdc;
3660+
p_extra_free[n_extra] = NUL;
3661+
p_extra = p_extra_free;
3662+
c_extra = NUL;
3663+
char_attr = hl_attr(HLF_FC);
3664+
}
36593665
}
36603666
}
36613667
#endif

src/testdir/Make_all.mak

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ NEW_TESTS = test_arglist.res \
148148
test_cscope.res \
149149
test_diffmode.res \
150150
test_digraph.res \
151+
test_display.res \
151152
test_farsi.res \
152153
test_fnameescape.res \
153154
test_gf.res \

src/testdir/test_display.vim

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
" Test for displaying stuff
2+
if !has('gui_running') && has('unix')
3+
set term=ansi
4+
endif
5+
6+
function! s:screenline(lnum, nr) abort
7+
let line = []
8+
for j in range(a:nr)
9+
for c in range(1, winwidth(0))
10+
call add(line, nr2char(screenchar(a:lnum+j, c)))
11+
endfor
12+
call add(line, "\n")
13+
endfor
14+
return join(line, '')
15+
endfunction
16+
17+
function! Test_display_foldcolumn()
18+
new
19+
vnew
20+
vert resize 25
21+
22+
1put='e more noise blah blah‚ more stuff here'
23+
24+
let expect = "e more noise blah blah<82\n> more stuff here \n"
25+
26+
call cursor(2, 1)
27+
norm! zt
28+
redraw!
29+
call assert_equal(expect, s:screenline(1,2))
30+
set fdc=2
31+
redraw!
32+
let expect = " e more noise blah blah<\n 82> more stuff here \n"
33+
call assert_equal(expect, s:screenline(1,2))
34+
35+
quit!
36+
quit!
37+
endfunction

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,8 @@ static char *(features[]) =
764764

765765
static int included_patches[] =
766766
{ /* Add new patch number below this line */
767+
/**/
768+
126,
767769
/**/
768770
125,
769771
/**/

0 commit comments

Comments
 (0)