diff src/testdir/test_diffmode.vim @ 33454:b91aeab2d62e v9.0.1981

patch 9.0.1981: not being able to scroll up in diff mode Commit: https://github.com/vim/vim/commit/0583491277dea9d14e000051c26405b90d839072 Author: zeertzjq <zeertzjq@outlook.com> Date: Wed Oct 4 20:12:37 2023 +0200 patch 9.0.1981: not being able to scroll up in diff mode Problem: Cannot scroll up in diff mode with many filler lines and zero 'scrolloff'. Solution: Invalidate w_cline_row before calling comp_botline(). closes: #13256 Signed-off-by: Christian Brabandt <cb@256bit.org> Co-authored-by: zeertzjq <zeertzjq@outlook.com>
author Christian Brabandt <cb@256bit.org>
date Wed, 04 Oct 2023 20:15:04 +0200
parents 9c6bc59b6d80
children 3d0544e31ca5
line wrap: on
line diff
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -1614,6 +1614,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