]> granicus.if.org Git - vim/commitdiff
patch 9.0.0758: "precedes" from 'listchars' overwritten by <<< v9.0.0758
authorBram Moolenaar <Bram@vim.org>
Sat, 15 Oct 2022 13:07:48 +0000 (14:07 +0100)
committerBram Moolenaar <Bram@vim.org>
Sat, 15 Oct 2022 13:07:48 +0000 (14:07 +0100)
Problem:    "precedes" from 'listchars' overwritten by <<< for 'smoothscroll'.
Solution:   Keep the "precedes" character.

src/drawline.c
src/testdir/dumps/Test_smooth_list_1.dump [new file with mode: 0644]
src/testdir/dumps/Test_smooth_list_2.dump [new file with mode: 0644]
src/testdir/test_scroll_opt.vim
src/version.c

index f3024c2fcc6699cc77db6f19f373a31ea68aa58c..8824a0121281f998575b10107e8d3ff6ee1fddea 100644 (file)
@@ -766,9 +766,11 @@ wlv_screen_line(win_T *wp, winlinevars_T *wlv, int negative_width)
 {
     if (wlv->row == 0 && wp->w_skipcol > 0
 #if defined(FEAT_LINEBREAK)
+           // do not overwrite the 'showbreak' text with "<<<"
            && *get_showbreak_value(wp) == NUL
 #endif
-           )
+           // do not overwrite the 'listchars' "precedes" text with "<<<"
+           && !(wp->w_p_list && wp->w_lcs_chars.prec != 0))
     {
        int off = (int)(current_ScreenLine - ScreenLines);
        int skip = 0;
diff --git a/src/testdir/dumps/Test_smooth_list_1.dump b/src/testdir/dumps/Test_smooth_list_1.dump
new file mode 100644 (file)
index 0000000..b155df2
--- /dev/null
@@ -0,0 +1,8 @@
+|<+0#4040ff13#ffffff0@2|t+0#0000000&| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| 
+>l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| 
+|v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| 
+|t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |$+0#4040ff13&| +0#0000000&@18
+|t|h|r|e@1|$+0#4040ff13&| +0#0000000&@33
+|~+0#4040ff13&| @38
+|~| @38
+| +0#0000000&@21|2|,|8|1| @9|B|o|t| 
diff --git a/src/testdir/dumps/Test_smooth_list_2.dump b/src/testdir/dumps/Test_smooth_list_2.dump
new file mode 100644 (file)
index 0000000..82d17b4
--- /dev/null
@@ -0,0 +1,8 @@
+|#+0#4040ff13#ffffff0|e+0#0000000&|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| 
+>l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| 
+|v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |v|e|r|y| |l|o|n|g| 
+|t|e|x|t| |v|e|r|y| |l|o|n|g| |t|e|x|t| |$+0#4040ff13&| +0#0000000&@18
+|t|h|r|e@1|$+0#4040ff13&| +0#0000000&@33
+|~+0#4040ff13&| @38
+|~| @38
+|:+0#0000000&|s|e|t| |l|i|s|t|c|h|a|r|s|+|=|p|r|e|c|e|d|2|,|8|1| @9|B|o|t| 
index 19c753d96e5a56952e8f4d69e04519dd829f3354..aba8603a657e1db7fee29a92487ea10d2243ae99 100644 (file)
@@ -155,6 +155,31 @@ func Test_smoothscroll_number()
   call StopVimInTerminal(buf)
 endfunc
 
+func Test_smoothscroll_list()
+  CheckScreendump
+
+  let lines =<< trim END
+      vim9script
+      set smoothscroll scrolloff=0
+      set list
+      setline(1, [
+        'one',
+        'very long text '->repeat(12),
+        'three',
+      ])
+      exe "normal 2Gzt\<C-E>"
+  END
+  call writefile(lines, 'XSmoothList', 'D')
+  let buf = RunVimInTerminal('-S XSmoothList', #{rows: 8, cols: 40})
+
+  call VerifyScreenDump(buf, 'Test_smooth_list_1', {})
+
+  call term_sendkeys(buf, ":set listchars+=precedes:#\<CR>")
+  call VerifyScreenDump(buf, 'Test_smooth_list_2', {})
+
+  call StopVimInTerminal(buf)
+endfunc
+
 func Test_smoothscroll_diff_mode()
   CheckScreendump
 
index 3211c530c99874a51a73091e432933c8457fb819..b5dc88fdb95f2732a87aa2ebf6f6e8c35b28c9a1 100644 (file)
@@ -695,6 +695,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    758,
 /**/
     757,
 /**/