Skip to content

Commit

Permalink
patch 9.0.0758: "precedes" from 'listchars' overwritten by <<<
Browse files Browse the repository at this point in the history
Problem:    "precedes" from 'listchars' overwritten by <<< for 'smoothscroll'.
Solution:   Keep the "precedes" character.
  • Loading branch information
brammool committed Oct 15, 2022
1 parent eb4de62 commit 13cdde3
Show file tree
Hide file tree
Showing 5 changed files with 46 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/drawline.c
Expand Up @@ -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;
Expand Down
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_smooth_list_1.dump
@@ -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|
8 changes: 8 additions & 0 deletions src/testdir/dumps/Test_smooth_list_2.dump
@@ -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|
25 changes: 25 additions & 0 deletions src/testdir/test_scroll_opt.vim
Expand Up @@ -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

Expand Down
2 changes: 2 additions & 0 deletions src/version.c
Expand Up @@ -695,6 +695,8 @@ static char *(features[]) =

static int included_patches[] =
{ /* Add new patch number below this line */
/**/
758,
/**/
757,
/**/
Expand Down

0 comments on commit 13cdde3

Please sign in to comment.