aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-10-05 07:36:14 +0800
committerGitHub <noreply@github.com>2023-10-05 07:36:14 +0800
commitd7a240b1e99201fcd8ce17509f115d583b6e53a1 (patch)
tree92fdf86db37420ff153768c3cde92fd4abb18016 /test
parent3079fa1f9f198bb303fa616004da9c269673c7a5 (diff)
downloadrneovim-d7a240b1e99201fcd8ce17509f115d583b6e53a1.tar.gz
rneovim-d7a240b1e99201fcd8ce17509f115d583b6e53a1.tar.bz2
rneovim-d7a240b1e99201fcd8ce17509f115d583b6e53a1.zip
vim-patch:9.0.1981: not being able to scroll up in diff mode (#25506)
Problem: Cannot scroll up in diff mode with many filler lines and zero 'scrolloff'. Solution: Invalidate w_cline_row before calling comp_botline(). closes: vim/vim#13256 https://github.com/vim/vim/commit/0583491277dea9d14e000051c26405b90d839072
Diffstat (limited to 'test')
-rw-r--r--test/old/testdir/test_diffmode.vim36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim
index d6d9f351fc..a06411883c 100644
--- a/test/old/testdir/test_diffmode.vim
+++ b/test/old/testdir/test_diffmode.vim
@@ -1616,6 +1616,42 @@ func Test_diff_scroll_wrap_on()
call assert_equal(1, winsaveview().topline)
normal! j
call assert_equal(2, winsaveview().topline)
+
+ bwipe!
+ bwipe!
+endfunc
+
+func Test_diff_scroll_many_filler()
+ 20new
+ vnew
+ call setline(1, ['^^^', '^^^', '$$$', '$$$'])
+ diffthis
+ setlocal scrolloff=0
+ wincmd p
+ call setline(1, ['^^^', '^^^'] + repeat(['###'], 41) + ['$$$', '$$$'])
+ 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)
+
bwipe!
bwipe!
endfunc