Skip to content

Commit 895d966

Browse files
committed
patch 8.1.0865: when 'listchars' only contains "nbsp:X" it does not work
Problem: When 'listchars' only contains "nbsp:X" it does not work. Solution: Set extra_check when lcs_nbsp is set. (Ralf Schandl, closes #3889)
1 parent 375e339 commit 895d966

3 files changed

Lines changed: 25 additions & 3 deletions

File tree

src/screen.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1164,8 +1164,6 @@ win_update(win_T *wp)
11641164
mod_bot = wp->w_redraw_bot + 1;
11651165
else
11661166
mod_bot = 0;
1167-
wp->w_redraw_top = 0; /* reset for next time */
1168-
wp->w_redraw_bot = 0;
11691167
if (buf->b_mod_set)
11701168
{
11711169
if (mod_top == 0 || mod_top > buf->b_mod_top)
@@ -1277,6 +1275,8 @@ win_update(win_T *wp)
12771275
if (mod_top != 0 && buf->b_mod_xlines != 0 && wp->w_p_nu)
12781276
mod_bot = MAXLNUM;
12791277
}
1278+
wp->w_redraw_top = 0; // reset for next time
1279+
wp->w_redraw_bot = 0;
12801280

12811281
/*
12821282
* When only displaying the lines at the top, set top_end. Used when
@@ -3498,7 +3498,7 @@ win_line(
34983498

34993499
if (wp->w_p_list)
35003500
{
3501-
if (lcs_space || lcs_trail)
3501+
if (lcs_space || lcs_trail || lcs_nbsp)
35023502
extra_check = TRUE;
35033503
/* find start of trailing whitespace */
35043504
if (lcs_trail)

src/testdir/test_listchars.vim

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,26 @@ func Test_listchars()
9090
\ '.....h>-$',
9191
\ 'iii<<<<><<$', '$'], l)
9292

93+
94+
" test nbsp
95+
normal ggdG
96+
set listchars=nbsp:X,trail:Y
97+
set list
98+
" Non-breaking space
99+
let nbsp = nr2char(0xa0)
100+
call append(0, [ ">".nbsp."<" ])
101+
102+
let expected = '>X< '
103+
104+
redraw!
105+
call cursor(1, 1)
106+
call assert_equal([expected], ScreenLines(1, virtcol('$')))
107+
108+
set listchars=nbsp:X
109+
redraw!
110+
call cursor(1, 1)
111+
call assert_equal([expected], ScreenLines(1, virtcol('$')))
112+
93113
enew!
94114
set listchars& ff&
95115
endfunc

src/version.c

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

784784
static int included_patches[] =
785785
{ /* Add new patch number below this line */
786+
/**/
787+
865,
786788
/**/
787789
864,
788790
/**/

0 commit comments

Comments
 (0)