]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1130: 'listchars' "precedes" is not drawn on Tabs. v9.1.1130
authorzeertzjq <zeertzjq@outlook.com>
Fri, 21 Feb 2025 18:49:44 +0000 (19:49 +0100)
committerChristian Brabandt <cb@256bit.org>
Fri, 21 Feb 2025 18:49:44 +0000 (19:49 +0100)
Problem:  'listchars' "precedes" is not drawn on Tabs.
Solution: Only draw 'listchars' "precedes" when not skipping over cells.
          (zeertzjq)

fixes: #5927
closes: #16691

Signed-off-by: zeertzjq <zeertzjq@outlook.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/drawline.c
src/testdir/dumps/Test_wincolor_lcs.dump
src/testdir/test_listchars.vim
src/version.c

index aabf4611109e612c7f71e632dad473e5c699a47e..f24e7e036d6d1daf94372d3b51478ccaa07d9623 100644 (file)
@@ -3727,6 +3727,7 @@ win_line(
                && wlv.filler_todo <= 0
 #endif
                && wlv.draw_state > WL_NR
+               && skip_cells <= 0
                && c != NUL)
        {
            c = wp->w_lcs_chars.prec;
index 1e146b23186b2f657fc45203373537a5c37c222b..3cbfc3fb485ce5ccb0b50f41139b45cd4affabe6 100644 (file)
@@ -1,5 +1,5 @@
 |<+0#4040ff13#ffff4012| +0#0000001&@73
-|-+0#0000e05&@2|>|-@6>s+0#0000001&|o|m|e|.+0#0000e05&|r+0#0000001&|a|n|d|o|m|.+0#0000e05&|*+0#e0e0e08#6c6c6c255|.+0#0000e05#ffff4012|e+0#0000001&|n|o|u|g|h|.+0#0000e05&|l+0#0000001&|o|n|g|.+0#0000e05&|t+0#0000001&|o|.+0#0000e05&|s+0#0000001&|h|o|w|.+0#0000e05&|'+0#0000001&|e|x|t|e|n|d|s|'|.+0#0000e05&|a+0#0000001&|n|d|.+0#0000e05&|'+0#0000001&|p|r|e|c|e|d|e|s|'|.+0#0000e05&|i+0#0000001&|n|c|l|>+0#4040ff13&
+|<+0#4040ff13&|-+0#0000e05&@1|>|-@6>s+0#0000001&|o|m|e|.+0#0000e05&|r+0#0000001&|a|n|d|o|m|.+0#0000e05&|*+0#e0e0e08#6c6c6c255|.+0#0000e05#ffff4012|e+0#0000001&|n|o|u|g|h|.+0#0000e05&|l+0#0000001&|o|n|g|.+0#0000e05&|t+0#0000001&|o|.+0#0000e05&|s+0#0000001&|h|o|w|.+0#0000e05&|'+0#0000001&|e|x|t|e|n|d|s|'|.+0#0000e05&|a+0#0000001&|n|d|.+0#0000e05&|'+0#0000001&|p|r|e|c|e|d|e|s|'|.+0#0000e05&|i+0#0000001&|n|c|l|>+0#4040ff13&
 |<| +0#0000001&@73
 |~+0#4040ff13&| @73
 |~| @73
index 481540d7ee8dca71bca9bff3611bd6ab1a7ec016..8bed38a589d277134658460095a4bfe314913ebb 100644 (file)
@@ -677,6 +677,7 @@ func Test_listchars_precedes_with_wide_char()
   call setline(1, '123口456')
   call assert_equal(['123口456$ '], ScreenLines(1, 10))
   let attr = screenattr(1, 9)
+
   normal! zl
   call assert_equal(['!3口456$  '], ScreenLines(1, 10))
   call assert_equal(attr, screenattr(1, 1))
@@ -688,8 +689,7 @@ func Test_listchars_precedes_with_wide_char()
   call assert_equal(attr, screenattr(1, 1))
   call assert_equal(attr, screenattr(1, 2))
   normal! zl
-  " TODO: should it be '!' instead of '<' here?
-  call assert_equal(['<456$     '], ScreenLines(1, 10))
+  call assert_equal(['!456$     '], ScreenLines(1, 10))
   call assert_equal(attr, screenattr(1, 1))
   normal! zl
   call assert_equal(['!56$      '], ScreenLines(1, 10))
@@ -701,4 +701,25 @@ func Test_listchars_precedes_with_wide_char()
   bw!
 endfunc
 
+func Test_listchars_precedes_with_tab()
+  new
+  setlocal nowrap list listchars=eol:$,precedes:!,tab:<->
+  call setline(1, "1234\t56")
+  let expected_line = '1234<-->56$ '
+  call assert_equal([expected_line], ScreenLines(1, 12))
+  let expected_attrs = mapnew(range(1, 12), 'screenattr(1, v:val)')
+  let attr = expected_attrs[-2]
+
+  for i in range(8)
+    normal! zl
+    let expected_line = '!' .. expected_line[2:] .. ' '
+    let expected_attrs = [attr] + expected_attrs[2:] + expected_attrs[-1:]
+    call assert_equal([expected_line], ScreenLines(1, 12))
+    let attrs = mapnew(range(1, 12), 'screenattr(1, v:val)')
+    call assert_equal(expected_attrs, attrs)
+  endfor
+
+  bw!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 646905303fe65ab10f9d5d064c3208794d7f4e30..6961a2719a649555fa7f835fe3b5dffac26326a3 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1130,
 /**/
     1129,
 /**/