]> granicus.if.org Git - vim/commitdiff
patch 9.0.1373: wrong text displayed when using both 'linebreak' and 'list' v9.0.1373
authorh-east <h.east.727@gmail.com>
Thu, 2 Mar 2023 18:49:09 +0000 (18:49 +0000)
committerBram Moolenaar <Bram@vim.org>
Thu, 2 Mar 2023 18:49:09 +0000 (18:49 +0000)
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)

src/drawline.c
src/testdir/test_listlbr.vim
src/version.c

index 5fe25f554f4a43240777e0c3ff5ea7d653fdabf0..5c647507d83d9ad7f390e66e77bb0edd7304a29b 100644 (file)
@@ -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
index 4a43feab745c9824596d7ff25e1d4820ead43123..198ad8c7f938065f6ab47891a92a3385591b386d 100644 (file)
@@ -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))
index bef7cf09c2aaed2ca98cdcc2715b62425dd0c8ff..ede31d62fe7ae922a009472ccf992c51be1abe38 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1373,
 /**/
     1372,
 /**/