vim-patch:9.1.0211: page-wise scrolling does not support smooth-scrolling

Problem:  Page-wise scrolling with Ctrl-F/Ctrl-B implements
          it's own logic to change the topline and cursor.
          In doing so, skipcol is not handled properly for
          'smoothscroll', and virtual lines.
Solution: Re-use the logic from Ctrl-E/Ctrl-Y while staying
          backward compatible as much as possible.

b9f5b95b7b
This commit is contained in:
Luuk van Baal
2024-03-26 19:06:39 +01:00
parent 19b443251f
commit 4147302f4b
9 changed files with 123 additions and 325 deletions

View File

@@ -832,7 +832,7 @@ func Test_smoothscroll_eob()
call VerifyScreenDump(buf, 'Test_smooth_eob_1', {})
" cursor is not placed below window
call term_sendkeys(buf, ":call setline(92, 'a'->repeat(100))\<CR>\<C-B>G")
call term_sendkeys(buf, ":call setline(92, 'a'->repeat(100))\<CR>\<C-L>\<C-B>G")
call VerifyScreenDump(buf, 'Test_smooth_eob_2', {})
call StopVimInTerminal(buf)
@@ -1001,4 +1001,26 @@ func Test_smoothscroll_textoff_small_winwidth()
set smoothscroll& number&
endfunc
func Test_smoothscroll_page()
set smoothscroll
10split | 40vsplit
call setline(1, 'abcde '->repeat(150))
exe "norm! \<C-F>"
call assert_equal(320, winsaveview().skipcol)
exe "norm! \<C-F>"
call assert_equal(640, winsaveview().skipcol)
exe "norm! \<C-F>"
call assert_equal(880, winsaveview().skipcol)
exe "norm! \<C-B>"
call assert_equal(560, winsaveview().skipcol)
exe "norm! \<C-B>"
call assert_equal(240, winsaveview().skipcol)
exe "norm! \<C-B>"
call assert_equal(0, winsaveview().skipcol)
set smoothscroll&
endfunc
" vim: shiftwidth=2 sts=2 expandtab