]> granicus.if.org Git - vim/commitdiff
patch 8.0.1169: highlignting one char too many with 'list' and 'cul' v8.0.1169
authorBram Moolenaar <Bram@vim.org>
Sun, 1 Oct 2017 12:35:02 +0000 (14:35 +0200)
committerBram Moolenaar <Bram@vim.org>
Sun, 1 Oct 2017 12:35:02 +0000 (14:35 +0200)
Problem:    Highlignting one char too many with 'list' and 'cul'.
Solution:   Check for 'list' being active. (Ozaki Kiichi, closes #2177)

src/screen.c
src/testdir/test_highlight.vim
src/version.c

index 8349e5f6b77ed2e142697e457bffce5d91ee8d42..3e08b600f69e1126c1777b0edc926bd7d4fe3bc1 100644 (file)
@@ -4169,7 +4169,8 @@ win_line(
                        cur = cur->next;
                }
                /* Only highlight one character after the last column. */
-               if (*ptr == NUL && did_line_attr >= 1)
+               if (*ptr == NUL && (did_line_attr >= 1
+                                   || (wp->w_p_list && lcs_eol_one == -1)))
                    search_attr = 0;
            }
 #endif
index 5205d425e2a6f9c5586b88c4e776f496b7fc5706..f3d7d0f2a000e4077d480a82780339221339c672 100644 (file)
@@ -59,6 +59,16 @@ function! HiCursorLine()
   return [hiCursorLine, hi_ul, hi_bg]
 endfunction
 
+function! Check_lcs_eol_attrs(attrs, row, col)
+  let save_lcs = &lcs
+  set list
+
+  call assert_equal(a:attrs, ScreenAttrs(a:row, a:col)[0])
+
+  set nolist
+  let &lcs = save_lcs
+endfunction
+
 func Test_highlight_eol_with_cursorline()
   let [hiCursorLine, hi_ul, hi_bg] = HiCursorLine()
 
@@ -83,7 +93,8 @@ func Test_highlight_eol_with_cursorline()
   " expected:
   " 'abcd      '
   "  ^^^^         underline
-  "      ^^^^^^   'Search' highlight with underline
+  "      ^        'Search' highlight with underline
+  "       ^^^^^   underline
   let attrs = ScreenAttrs(1, 10)[0]
   call assert_equal(repeat([attrs[0]], 4), attrs[0:3])
   call assert_equal([attrs[4]] + repeat([attrs[5]], 5), attrs[4:9])
@@ -91,6 +102,7 @@ func Test_highlight_eol_with_cursorline()
   call assert_notequal(attrs[4], attrs[5])
   call assert_notequal(attrs0[0], attrs[0])
   call assert_notequal(attrs0[4], attrs[4])
+  call Check_lcs_eol_attrs(attrs, 1, 10)
 
   if IsColorable()
     " bg-color
@@ -109,6 +121,7 @@ func Test_highlight_eol_with_cursorline()
     call assert_notequal(attrs[4], attrs[5])
     call assert_notequal(attrs0[0], attrs[0])
     call assert_notequal(attrs0[5], attrs[5])
+    call Check_lcs_eol_attrs(attrs, 1, 10)
   endif
 
   call CloseWindow()
@@ -168,6 +181,7 @@ func Test_highlight_eol_with_cursorline_vertsplit()
   call assert_notequal(attrs[5], attrs[6])
   call assert_notequal(attrs0[0], attrs[0])
   call assert_notequal(attrs0[4], attrs[4])
+  call Check_lcs_eol_attrs(attrs, 1, 15)
 
   if IsColorable()
     " bg-color
@@ -187,6 +201,7 @@ func Test_highlight_eol_with_cursorline_vertsplit()
     call assert_notequal(attrs[5], attrs[6])
     call assert_notequal(attrs0[0], attrs[0])
     call assert_equal(attrs0[4], attrs[4])
+    call Check_lcs_eol_attrs(attrs, 1, 15)
   endif
 
   call CloseWindow()
@@ -223,6 +238,7 @@ func Test_highlight_eol_with_cursorline_rightleft()
   call assert_notequal(attrs[4], attrs[5])
   call assert_notequal(attrs0[9], attrs[9])
   call assert_notequal(attrs0[5], attrs[5])
+  call Check_lcs_eol_attrs(attrs, 1, 10)
 
   if IsColorable()
     " bg-color
@@ -241,6 +257,7 @@ func Test_highlight_eol_with_cursorline_rightleft()
     call assert_notequal(attrs[5], attrs[4])
     call assert_notequal(attrs0[9], attrs[9])
     call assert_notequal(attrs0[4], attrs[4])
+    call Check_lcs_eol_attrs(attrs, 1, 10)
   endif
 
   call CloseWindow()
@@ -274,6 +291,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
   call assert_notequal(attrs[4], attrs[5])
   call assert_notequal(attrs0[0], attrs[0])
   call assert_notequal(attrs0[4], attrs[4])
+  call Check_lcs_eol_attrs(attrs, 5, 10)
 
   if IsColorable()
     " bg-color
@@ -292,6 +310,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
     call assert_notequal(attrs[4], attrs[5])
     call assert_notequal(attrs0[0], attrs[0])
     call assert_notequal(attrs0[5], attrs[5])
+    call Check_lcs_eol_attrs(attrs, 5, 10)
   endif
 
   setlocal nocursorline nowrap
@@ -314,6 +333,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
   call assert_notequal(attrs[6], attrs[7])
   call assert_notequal(attrs0[0], attrs[0])
   call assert_notequal(attrs0[6], attrs[6])
+  call Check_lcs_eol_attrs(attrs, 1, 10)
 
   if IsColorable()
     " bg-color
@@ -332,6 +352,7 @@ func Test_highlight_eol_with_cursorline_linewrap()
     call assert_notequal(attrs[6], attrs[7])
     call assert_notequal(attrs0[0], attrs[0])
     call assert_notequal(attrs0[7], attrs[7])
+    call Check_lcs_eol_attrs(attrs, 1, 10)
   endif
 
   call CloseWindow()
@@ -370,6 +391,7 @@ func Test_highlight_eol_with_cursorline_sign()
   call assert_notequal(attrs[6], attrs[7])
   call assert_notequal(attrs0[2], attrs[2])
   call assert_notequal(attrs0[6], attrs[6])
+  call Check_lcs_eol_attrs(attrs, 1, 10)
 
   if IsColorable()
     " bg-color
@@ -389,6 +411,7 @@ func Test_highlight_eol_with_cursorline_sign()
     call assert_notequal(attrs[6], attrs[7])
     call assert_notequal(attrs0[2], attrs[2])
     call assert_notequal(attrs0[7], attrs[7])
+    call Check_lcs_eol_attrs(attrs, 1, 10)
   endif
 
   sign unplace 1
@@ -431,6 +454,7 @@ func Test_highlight_eol_with_cursorline_breakindent()
   call assert_notequal(attrs0[2], attrs[2])
   call assert_notequal(attrs0[3], attrs[3])
   call assert_notequal(attrs0[6], attrs[6])
+  call Check_lcs_eol_attrs(attrs, 2, 10)
 
   if IsColorable()
     " bg-color
@@ -455,6 +479,7 @@ func Test_highlight_eol_with_cursorline_breakindent()
     call assert_notequal(attrs0[2], attrs[2])
     call assert_notequal(attrs0[3], attrs[3])
     call assert_notequal(attrs0[7], attrs[7])
+    call Check_lcs_eol_attrs(attrs, 2, 10)
   endif
 
   call CloseWindow()
@@ -484,6 +509,7 @@ func Test_highlight_eol_on_diff()
   call assert_notequal(attrs[0], attrs[2])
   call assert_notequal(attrs[0], attrs[6])
   call assert_notequal(attrs[2], attrs[6])
+  call Check_lcs_eol_attrs(attrs, 1, 10)
 
   bwipe!
   diffoff
index a129ec97d0bac46b818b5a893d7a9f803aed4d5b..23859a11764d98f7d55b1c4a5fe58bb3a62c69b6 100644 (file)
@@ -761,6 +761,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1169,
 /**/
     1168,
 /**/