Skip to content

Commit 5ece3e3

Browse files
committed
patch 8.0.1169: highlignting one char too many with 'list' and 'cul'
Problem: Highlignting one char too many with 'list' and 'cul'. Solution: Check for 'list' being active. (Ozaki Kiichi, closes #2177)
1 parent 0aa398f commit 5ece3e3

File tree

3 files changed

+31
-2
lines changed

3 files changed

+31
-2
lines changed

src/screen.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4169,7 +4169,8 @@ win_line(
41694169
cur = cur->next;
41704170
}
41714171
/* Only highlight one character after the last column. */
4172-
if (*ptr == NUL && did_line_attr >= 1)
4172+
if (*ptr == NUL && (did_line_attr >= 1
4173+
|| (wp->w_p_list && lcs_eol_one == -1)))
41734174
search_attr = 0;
41744175
}
41754176
#endif

src/testdir/test_highlight.vim

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,16 @@ function! HiCursorLine()
5959
return [hiCursorLine, hi_ul, hi_bg]
6060
endfunction
6161

62+
function! Check_lcs_eol_attrs(attrs, row, col)
63+
let save_lcs = &lcs
64+
set list
65+
66+
call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0])
67+
68+
set nolist
69+
let &lcs = save_lcs
70+
endfunction
71+
6272
func Test_highlight_eol_with_cursorline()
6373
let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
6474

@@ -83,14 +93,16 @@ func Test_highlight_eol_with_cursorline()
8393
" expected:
8494
" 'abcd '
8595
" ^^^^ underline
86-
" ^^^^^^ 'Search' highlight with underline
96+
" ^ 'Search' highlight with underline
97+
" ^^^^^ underline
8798
let attrs = ScreenAttrs(1, 10)[0]
8899
call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
89100
call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
90101
call assert_notequal(attrs[0], attrs[4])
91102
call assert_notequal(attrs[4], attrs[5])
92103
call assert_notequal(attrs0[0], attrs[0])
93104
call assert_notequal(attrs0[4], attrs[4])
105+
call Check_lcs_eol_attrs(attrs, 1, 10)
94106

95107
if IsColorable()
96108
" bg-color
@@ -109,6 +121,7 @@ func Test_highlight_eol_with_cursorline()
109121
call assert_notequal(attrs[4], attrs[5])
110122
call assert_notequal(attrs0[0], attrs[0])
111123
call assert_notequal(attrs0[5], attrs[5])
124+
call Check_lcs_eol_attrs(attrs, 1, 10)
112125
endif
113126

114127
call CloseWindow()
@@ -168,6 +181,7 @@ func Test_highlight_eol_with_cursorline_vertsplit()
168181
call assert_notequal(attrs[5], attrs[6])
169182
call assert_notequal(attrs0[0], attrs[0])
170183
call assert_notequal(attrs0[4], attrs[4])
184+
call Check_lcs_eol_attrs(attrs, 1, 15)
171185

172186
if IsColorable()
173187
" bg-color
@@ -187,6 +201,7 @@ func Test_highlight_eol_with_cursorline_vertsplit()
187201
call assert_notequal(attrs[5], attrs[6])
188202
call assert_notequal(attrs0[0], attrs[0])
189203
call assert_equal(attrs0[4], attrs[4])
204+
call Check_lcs_eol_attrs(attrs, 1, 15)
190205
endif
191206

192207
call CloseWindow()
@@ -223,6 +238,7 @@ func Test_highlight_eol_with_cursorline_rightleft()
223238
call assert_notequal(attrs[4], attrs[5])
224239
call assert_notequal(attrs0[9], attrs[9])
225240
call assert_notequal(attrs0[5], attrs[5])
241+
call Check_lcs_eol_attrs(attrs, 1, 10)
226242

227243
if IsColorable()
228244
" bg-color
@@ -241,6 +257,7 @@ func Test_highlight_eol_with_cursorline_rightleft()
241257
call assert_notequal(attrs[5], attrs[4])
242258
call assert_notequal(attrs0[9], attrs[9])
243259
call assert_notequal(attrs0[4], attrs[4])
260+
call Check_lcs_eol_attrs(attrs, 1, 10)
244261
endif
245262

246263
call CloseWindow()
@@ -274,6 +291,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
274291
call assert_notequal(attrs[4], attrs[5])
275292
call assert_notequal(attrs0[0], attrs[0])
276293
call assert_notequal(attrs0[4], attrs[4])
294+
call Check_lcs_eol_attrs(attrs, 5, 10)
277295

278296
if IsColorable()
279297
" bg-color
@@ -292,6 +310,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
292310
call assert_notequal(attrs[4], attrs[5])
293311
call assert_notequal(attrs0[0], attrs[0])
294312
call assert_notequal(attrs0[5], attrs[5])
313+
call Check_lcs_eol_attrs(attrs, 5, 10)
295314
endif
296315

297316
setlocal nocursorline nowrap
@@ -314,6 +333,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
314333
call assert_notequal(attrs[6], attrs[7])
315334
call assert_notequal(attrs0[0], attrs[0])
316335
call assert_notequal(attrs0[6], attrs[6])
336+
call Check_lcs_eol_attrs(attrs, 1, 10)
317337

318338
if IsColorable()
319339
" bg-color
@@ -332,6 +352,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
332352
call assert_notequal(attrs[6], attrs[7])
333353
call assert_notequal(attrs0[0], attrs[0])
334354
call assert_notequal(attrs0[7], attrs[7])
355+
call Check_lcs_eol_attrs(attrs, 1, 10)
335356
endif
336357

337358
call CloseWindow()
@@ -370,6 +391,7 @@ func Test_highlight_eol_with_cursorline_sign()
370391
call assert_notequal(attrs[6], attrs[7])
371392
call assert_notequal(attrs0[2], attrs[2])
372393
call assert_notequal(attrs0[6], attrs[6])
394+
call Check_lcs_eol_attrs(attrs, 1, 10)
373395

374396
if IsColorable()
375397
" bg-color
@@ -389,6 +411,7 @@ func Test_highlight_eol_with_cursorline_sign()
389411
call assert_notequal(attrs[6], attrs[7])
390412
call assert_notequal(attrs0[2], attrs[2])
391413
call assert_notequal(attrs0[7], attrs[7])
414+
call Check_lcs_eol_attrs(attrs, 1, 10)
392415
endif
393416

394417
sign unplace 1
@@ -431,6 +454,7 @@ func Test_highlight_eol_with_cursorline_breakindent()
431454
call assert_notequal(attrs0[2], attrs[2])
432455
call assert_notequal(attrs0[3], attrs[3])
433456
call assert_notequal(attrs0[6], attrs[6])
457+
call Check_lcs_eol_attrs(attrs, 2, 10)
434458

435459
if IsColorable()
436460
" bg-color
@@ -455,6 +479,7 @@ func Test_highlight_eol_with_cursorline_breakindent()
455479
call assert_notequal(attrs0[2], attrs[2])
456480
call assert_notequal(attrs0[3], attrs[3])
457481
call assert_notequal(attrs0[7], attrs[7])
482+
call Check_lcs_eol_attrs(attrs, 2, 10)
458483
endif
459484

460485
call CloseWindow()
@@ -484,6 +509,7 @@ func Test_highlight_eol_on_diff()
484509
call assert_notequal(attrs[0], attrs[2])
485510
call assert_notequal(attrs[0], attrs[6])
486511
call assert_notequal(attrs[2], attrs[6])
512+
call Check_lcs_eol_attrs(attrs, 1, 10)
487513

488514
bwipe!
489515
diffoff

src/version.c

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

762762
static int included_patches[] =
763763
{ /* Add new patch number below this line */
764+
/**/
765+
1169,
764766
/**/
765767
1168,
766768
/**/

0 commit comments

Comments
 (0)