From 9f85dace94d2682f076ede824d3516cdf779ff7b Mon Sep 17 00:00:00 2001 From: zeertzjq Date: Fri, 14 Feb 2025 07:21:45 +0800 Subject: vim-patch:9.1.1108: 'smoothscroll' gets stuck with 'listchars' "eol" (#32434) Problem: 'smoothscroll' gets stuck with 'listchars' "eol". Solution: Count size of 'listchars' "eol" in line size when scrolling. (zeertzjq) related: neovim/neovim#32405 closes: vim/vim#16627 https://github.com/vim/vim/commit/2c47ab8fcd7188fa87053c757ea86b0d846c06c1 --- test/old/testdir/test_scroll_opt.vim | 55 ++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) (limited to 'test') diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index 55f9a32718..14092757a1 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -1219,4 +1219,59 @@ func Test_smooth_long_scrolloff() call StopVimInTerminal(buf) endfunc +func Test_smoothscroll_listchars_eol() + call NewWindow(10, 40) + setlocal list listchars=eol:$ scrolloff=0 smoothscroll + call setline(1, repeat('-', 40)) + call append(1, repeat(['foobar'], 10)) + + normal! G + call assert_equal(2, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + exe "normal! \" + call assert_equal(1, line('w0')) + call assert_equal(40, winsaveview().skipcol) + + exe "normal! \" + call assert_equal(1, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + exe "normal! \" + call assert_equal(1, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + exe "normal! \" + call assert_equal(1, line('w0')) + call assert_equal(40, winsaveview().skipcol) + + exe "normal! \" + call assert_equal(2, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + for ve in ['', 'all', 'onemore'] + let &virtualedit = ve + normal! gg + call assert_equal(1, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + exe "normal! \" + redraw " redrawing should not cause another scroll + call assert_equal(1, line('w0')) + call assert_equal(40, winsaveview().skipcol) + + exe "normal! \" + redraw + call assert_equal(2, line('w0')) + call assert_equal(0, winsaveview().skipcol) + + if ve != 'all' + call assert_equal([0, 2, 1, 0], getpos('.')) + endif + endfor + + set virtualedit& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab -- cgit