]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1124: No test for 'listchars' "precedes" with double-width char v9.1.1124
authorzeertzjq <zeertzjq@outlook.com>
Thu, 20 Feb 2025 21:04:09 +0000 (22:04 +0100)
committerChristian Brabandt <cb@256bit.org>
Thu, 20 Feb 2025 21:04:09 +0000 (22:04 +0100)
Problem:  No test for 'listchars' "precedes" with double-width char.
Solution: Add a test and fix a typo in code (zeertzjq).

closes: #16675

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

index f0a7a92a996cb3462cebf8d6584911cefdb9a78d..aabf4611109e612c7f71e632dad473e5c699a47e 100644 (file)
@@ -3718,7 +3718,7 @@ win_line(
 #endif
        // Handle the case where we are in column 0 but not on the first
        // character of the line and the user wants us to show us a
-       // special character (via 'listchars' option "precedes:<char>".
+       // special character (via 'listchars' option "precedes:<char>").
        if (lcs_prec_todo != NUL
                && wp->w_p_list
                && (wp->w_p_wrap ? (wp->w_skipcol > 0 && wlv.row == 0)
index 46e96de02b1c785e6e01333144164d24c9f6b967..481540d7ee8dca71bca9bff3611bd6ab1a7ec016 100644 (file)
@@ -671,5 +671,34 @@ func Test_listchars_foldcolumn()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_listchars_precedes_with_wide_char()
+  new
+  setlocal nowrap list listchars=eol:$,precedes:!
+  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))
+  normal! zl
+  call assert_equal(['!口456$   '], ScreenLines(1, 10))
+  call assert_equal(attr, screenattr(1, 1))
+  normal! zl
+  call assert_equal(['!<456$    '], ScreenLines(1, 10))
+  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(attr, screenattr(1, 1))
+  normal! zl
+  call assert_equal(['!56$      '], ScreenLines(1, 10))
+  call assert_equal(attr, screenattr(1, 1))
+  normal! zl
+  call assert_equal(['!6$       '], ScreenLines(1, 10))
+  call assert_equal(attr, screenattr(1, 1))
+
+  bw!
+endfunc
 
 " vim: shiftwidth=2 sts=2 expandtab
index 0e7e236ea2552f8236ae998a507bc7482aa27d27..33640818faa0a0890b34ed200c4c9075aa7a7d0b 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1124,
 /**/
     1123,
 /**/