summaryrefslogtreecommitdiffstats
path: root/src/testdir/test_diffmode.vim
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-27 02:10:58 +0000
commitbee19c22d569e54513a9c591441c7f411811dc81 (patch)
treeb990d2df9fddb8194bfe49e9205005a0d952bc1f /src/testdir/test_diffmode.vim
parentAdding upstream version 2:9.1.0199. (diff)
downloadvim-bee19c22d569e54513a9c591441c7f411811dc81.tar.xz
vim-bee19c22d569e54513a9c591441c7f411811dc81.zip
Adding upstream version 2:9.1.0374.upstream/2%9.1.0374
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/testdir/test_diffmode.vim')
-rw-r--r--src/testdir/test_diffmode.vim62
1 files changed, 42 insertions, 20 deletions
diff --git a/src/testdir/test_diffmode.vim b/src/testdir/test_diffmode.vim
index 7602bd3..098d5d0 100644
--- a/src/testdir/test_diffmode.vim
+++ b/src/testdir/test_diffmode.vim
@@ -1647,36 +1647,39 @@ 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
- bwipe!
- bwipe!
+ set smoothscroll&
+ %bwipe!
endfunc
" This was trying to update diffs for a buffer being closed
@@ -2020,4 +2023,23 @@ func Test_diff_toggle_wrap_skipcol_leftcol()
bwipe!
endfunc
+" Ctrl-D reveals filler lines below the last line in the buffer.
+func Test_diff_eob_halfpage()
+ new
+ call setline(1, ['']->repeat(10) + ['a'])
+ diffthis
+ new
+ call setline(1, ['']->repeat(3) + ['a', 'b'])
+ diffthis
+ resize 5
+ wincmd j
+ resize 5
+ norm G
+ call assert_equal(7, line('w0'))
+ exe "norm! \<C-D>"
+ call assert_equal(8, line('w0'))
+
+ %bwipe!
+endfunc
+
" vim: shiftwidth=2 sts=2 expandtab