diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2024-04-08 22:40:55 +0200 |
---|---|---|
committer | Luuk van Baal <luukvbaal@gmail.com> | 2024-04-09 00:51:06 +0200 |
commit | 8f5fd0884b4424d028feef1bccd018a48c93a59c (patch) | |
tree | 9218c97bc1076dd8cd84fac9588bbbd0578b049e /test/old | |
parent | e21423bb35077fe4bbb6a8fab1000e8bfc6b6b7b (diff) | |
download | rneovim-8f5fd0884b4424d028feef1bccd018a48c93a59c.tar.gz rneovim-8f5fd0884b4424d028feef1bccd018a48c93a59c.tar.bz2 rneovim-8f5fd0884b4424d028feef1bccd018a48c93a59c.zip |
vim-patch:9.1.0280: several issues with 'smoothscroll' support
Problem: Logic to make sure cursor is in visible part of the screen after
scrolling the text with 'smoothscroll' is scattered, asymmetric
and contains bugs.
Solution: Adjust and create helper function for 'smoothscroll' cursor logic.
(Luuk van Baal)
https://github.com/vim/vim/commit/9148ba8a46baa3934c44164989cdcdec5d01d9e3
Diffstat (limited to 'test/old')
-rw-r--r-- | test/old/testdir/test_diffmode.vim | 15 | ||||
-rw-r--r-- | test/old/testdir/test_scroll_opt.vim | 38 |
2 files changed, 41 insertions, 12 deletions
diff --git a/test/old/testdir/test_diffmode.vim b/test/old/testdir/test_diffmode.vim index 67f6aaecbb..334bb3ee32 100644 --- a/test/old/testdir/test_diffmode.vim +++ b/test/old/testdir/test_diffmode.vim @@ -1772,4 +1772,19 @@ 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() + 5new + call setline(1, ['']->repeat(10) + ['a']) + diffthis + 5new + call setline(1, ['']->repeat(3) + ['a', 'b']) + diffthis + wincmd j + exe "norm! G\<C-D>" + call assert_equal(6, line('w0')) + + %bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim index d381456032..cb37b09707 100644 --- a/test/old/testdir/test_scroll_opt.vim +++ b/test/old/testdir/test_scroll_opt.vim @@ -1023,30 +1023,36 @@ func Test_smoothscroll_page() " Half-page scrolling does not go beyond end of buffer and moves the cursor. " Even with 'nostartofline', the correct amount of lines is scrolled. setl nostartofline - exe "norm! 0\<C-D>" + exe "norm! 15|\<C-D>" call assert_equal(200, winsaveview().skipcol) - call assert_equal(204, col('.')) + call assert_equal(215, col('.')) exe "norm! \<C-D>" call assert_equal(400, winsaveview().skipcol) - call assert_equal(404, col('.')) + call assert_equal(415, col('.')) exe "norm! \<C-D>" call assert_equal(520, winsaveview().skipcol) - call assert_equal(601, col('.')) + call assert_equal(535, col('.')) exe "norm! \<C-D>" call assert_equal(520, winsaveview().skipcol) - call assert_equal(801, col('.')) - exe "norm! \<C-U>" + call assert_equal(735, col('.')) + exe "norm! \<C-D>" call assert_equal(520, winsaveview().skipcol) - call assert_equal(601, col('.')) + call assert_equal(895, col('.')) exe "norm! \<C-U>" - call assert_equal(400, winsaveview().skipcol) - call assert_equal(404, col('.')) + call assert_equal(320, winsaveview().skipcol) + call assert_equal(695, col('.')) exe "norm! \<C-U>" - call assert_equal(200, winsaveview().skipcol) - call assert_equal(204, col('.')) + call assert_equal(120, winsaveview().skipcol) + call assert_equal(495, col('.')) + exe "norm! \<C-U>" + call assert_equal(0, winsaveview().skipcol) + call assert_equal(375, col('.')) exe "norm! \<C-U>" call assert_equal(0, winsaveview().skipcol) - call assert_equal(40, col('.')) + call assert_equal(175, col('.')) + exe "norm! \<C-U>" + call assert_equal(0, winsaveview().skipcol) + call assert_equal(15, col('.')) bwipe! endfunc @@ -1074,6 +1080,14 @@ func Test_smoothscroll_next_topline() redraw call assert_equal(2, line('w0')) + " Cursor does not end up above topline, adjusting topline later. + setlocal nu cpo+=n + exe "norm! G$g013\<C-Y>" + redraw + call assert_equal(2, line('.')) + call assert_equal(0, winsaveview().skipcol) + + set cpo-=n bwipe! endfunc |