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

2c47ab8fcd
This commit is contained in:
zeertzjq
2025-02-14 07:21:45 +08:00
committed by GitHub
parent 93480f7fba
commit 9f85dace94
7 changed files with 91 additions and 18 deletions

View File

@@ -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! \<C-Y>"
call assert_equal(1, line('w0'))
call assert_equal(40, winsaveview().skipcol)
exe "normal! \<C-Y>"
call assert_equal(1, line('w0'))
call assert_equal(0, winsaveview().skipcol)
exe "normal! \<C-Y>"
call assert_equal(1, line('w0'))
call assert_equal(0, winsaveview().skipcol)
exe "normal! \<C-E>"
call assert_equal(1, line('w0'))
call assert_equal(40, winsaveview().skipcol)
exe "normal! \<C-E>"
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! \<C-E>"
redraw " redrawing should not cause another scroll
call assert_equal(1, line('w0'))
call assert_equal(40, winsaveview().skipcol)
exe "normal! \<C-E>"
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