mirror of
https://github.com/vim/vim.git
synced 2025-10-05 05:34:07 -04:00
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. closes: #14268 Signed-off-by: Luuk van Baal <luukvbaal@gmail.com> Signed-off-by: Christian Brabandt <cb@256bit.org>
This commit is contained in:
committed by
Christian Brabandt
parent
9ccc297237
commit
b9f5b95b7b
@@ -1647,34 +1647,38 @@ endfunc
|
||||
func Test_diff_scroll_many_filler()
|
||||
20new
|
||||
vnew
|
||||
call setline(1, ['^^^', '^^^', '$$$', '$$$'])
|
||||
call setline(1, range(1, 40))
|
||||
diffthis
|
||||
setlocal scrolloff=0
|
||||
wincmd p
|
||||
call setline(1, ['^^^', '^^^'] + repeat(['###'], 41) + ['$$$', '$$$'])
|
||||
call setline(1, range(1, 20)->reverse() + ['###']->repeat(41) + range(21, 40)->reverse())
|
||||
diffthis
|
||||
setlocal scrolloff=0
|
||||
wincmd p
|
||||
redraw
|
||||
|
||||
" Note: need a redraw after each scroll, otherwise the test always passes.
|
||||
normal! G
|
||||
redraw
|
||||
call assert_equal(3, winsaveview().topline)
|
||||
call assert_equal(18, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(3, winsaveview().topline)
|
||||
call assert_equal(19, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(2, winsaveview().topline)
|
||||
call assert_equal(0, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(1, winsaveview().topline)
|
||||
call assert_equal(0, winsaveview().topfill)
|
||||
for _ in range(2)
|
||||
normal! G
|
||||
redraw
|
||||
call assert_equal(40, winsaveview().topline)
|
||||
call assert_equal(19, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(22, winsaveview().topline)
|
||||
call assert_equal(0, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(4, winsaveview().topline)
|
||||
call assert_equal(0, winsaveview().topfill)
|
||||
exe "normal! \<C-B>"
|
||||
redraw
|
||||
call assert_equal(1, winsaveview().topline)
|
||||
call assert_equal(0, winsaveview().topfill)
|
||||
set smoothscroll
|
||||
endfor
|
||||
|
||||
set smoothscroll&
|
||||
bwipe!
|
||||
bwipe!
|
||||
endfunc
|
||||
|
Reference in New Issue
Block a user