diff --git a/src/nvim/grid.c b/src/nvim/grid.c index 8431c078b9..9e830413bd 100644 --- 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 index 5e54470bd4..b5a571d8b5 100644 --- 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\" + ]]) + screen:expect([[ + <<repeat(12), + 'three', + ]) + exe "normal 2Gzt\" + 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:#\") + call VerifyScreenDump(buf, 'Test_smooth_list_2', {}) + + call StopVimInTerminal(buf) +endfunc + func Test_smoothscroll_diff_mode() CheckScreendump