changeset 32084:fe1550f920d8 v9.0.1373

patch 9.0.1373: wrong text displayed when using both 'linebreak' and 'list' Commit: https://github.com/vim/vim/commit/194555c001f2b8576483ef34511450b6e9b5e3fd Author: h-east <h.east.727@gmail.com> Date: Thu Mar 2 18:49:09 2023 +0000 patch 9.0.1373: wrong text displayed when using both 'linebreak' and 'list' Problem: Wrong text displayed when using both 'linebreak' and 'list'. Solution: Only set "c_extra" to NUL when "p_extra" is not empty. (Hirohito Higashi, closes #12065)
author Bram Moolenaar <Bram@vim.org>
date Thu, 02 Mar 2023 20:00:04 +0100
parents f3e0377c99a3
children 0ba2a862d86a
files src/drawline.c src/testdir/test_listlbr.vim src/version.c
diffstat 3 files changed, 28 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/src/drawline.c
+++ b/src/drawline.c
@@ -3095,7 +3095,8 @@ win_line(
 							? wp->w_lcs_chars.tab3
 							: wp->w_lcs_chars.tab1;
 #ifdef FEAT_LINEBREAK
-			if (wp->w_p_lbr && wlv.p_extra != NULL)
+			if (wp->w_p_lbr && wlv.p_extra != NULL
+							&& *wlv.p_extra != NUL)
 			    wlv.c_extra = NUL; // using p_extra from above
 			else
 #endif
--- a/src/testdir/test_listlbr.vim
+++ b/src/testdir/test_listlbr.vim
@@ -73,6 +73,30 @@ func Test_linebreak_with_nolist()
   call s:close_windows()
 endfunc
 
+func Test_linebreak_with_list_and_number()
+  call s:test_windows('setl list listchars+=tab:>-')
+  call setline(1, ["abcdefg\thijklmnopqrstu", "v"])
+  let lines = s:screen_lines([1, 4], winwidth(0))
+  let expect_nonumber = [
+\ "abcdefg>------------",
+\ "hijklmnopqrstu$     ",
+\ "v$                  ",
+\ "~                   ",
+\ ]
+  call s:compare_lines(expect_nonumber, lines)
+
+  setl number
+  let lines = s:screen_lines([1, 4], winwidth(0))
+  let expect_number = [
+\ "  1 abcdefg>--------",
+\ "    hijklmnopqrstu$ ",
+\ "  2 v$              ",
+\ "~                   ",
+\ ]
+  call s:compare_lines(expect_number, lines)
+  call s:close_windows()
+endfunc
+
 func Test_should_break()
   call s:test_windows('setl sbr=+ nolist')
   call setline(1, "1\t" . repeat('a', winwidth(0)-2))
--- a/src/version.c
+++ b/src/version.c
@@ -696,6 +696,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1373,
+/**/
     1372,
 /**/
     1371,