neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit 72c525d5675bc017fa52bcc74a394db7d01e6359
parent 6146400605af93ac48dae4393569c44e8a2e39d2
Author: Luuk van Baal <luukvbaal@gmail.com>
Date:   Thu, 27 Apr 2023 02:54:51 +0200

vim-patch:9.0.0758: "precedes" from 'listchars' overwritten by <<<

Problem:    "precedes" from 'listchars' overwritten by <<< for 'smoothscroll'.
Solution:   Keep the "precedes" character.

https://github.com/vim/vim/commit/13cdde39520220bb856cba16626327c706752b51

Co-authored-by: Bram Moolenaar <Bram@vim.org>

Diffstat:
Msrc/nvim/grid.c | 9++++++---
Mtest/functional/legacy/scroll_opt_spec.lua | 32++++++++++++++++++++++++++++++++
Mtest/old/testdir/test_scroll_opt.vim | 25+++++++++++++++++++++++++
3 files changed, 63 insertions(+), 3 deletions(-)

diff --git a/src/nvim/grid.c b/src/nvim/grid.c @@ -530,9 +530,12 @@ void grid_put_linebuf(ScreenGrid *grid, int row, int coloff, int endcol, int cle max_off_from = linebuf_size; max_off_to = grid->line_offset[row] + (size_t)grid->cols; - if (topline && wp->w_skipcol > 0 && *get_showbreak_value(wp) == NUL) { - // Take care of putting "<<<" on the first line for 'smoothscroll' - // when 'showbreak' is not set. + // Take care of putting "<<<" on the first line for 'smoothscroll'. + if (topline && wp->w_skipcol > 0 + // do not overwrite the 'showbreak' text with "<<<" + && *get_showbreak_value(wp) == NUL + // do not overwrite the 'listchars' "precedes" text with "<<<" + && !(wp->w_p_list && wp->w_p_lcs_chars.prec != 0)) { int off = 0; int skip = 0; if (wp->w_p_nu && wp->w_p_rnu) { diff --git a/test/functional/legacy/scroll_opt_spec.lua b/test/functional/legacy/scroll_opt_spec.lua @@ -294,6 +294,38 @@ describe('smoothscroll', function() ]]) end) + -- oldtest: Test_smoothscroll_list() + it("works with list mode", function() + screen:try_resize(40, 8) + exec([[ + set smoothscroll scrolloff=0 + set list + call setline(1, [ 'one', 'very long text '->repeat(12), 'three', ]) + exe "normal 2Gzt\<C-E>" + ]]) + screen:expect([[ + <<<t very long text very long text very | + ^long text very long text very long text | + very long text very long text very long | + text very long text- | + three | + ~ | + ~ | + | + ]]) + exec('set listchars+=precedes:#') + screen:expect([[ + #ext very long text very long text very | + ^long text very long text very long text | + very long text very long text very long | + text very long text- | + three | + ~ | + ~ | + | + ]]) + end) + -- oldtest: Test_smoothscroll_diff_mode() it("works with diff mode", function() screen:try_resize(40, 8) diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim @@ -172,6 +172,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