Mercurial > vim
diff src/testdir/test_normal.vim @ 34665:ca2da8e8fb53 v9.1.0215
patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Commit: https://github.com/vim/vim/commit/5a2e3ec9ac72b6e644fea4ebba7e632498296e2f
Author: Luuk van Baal <luukvbaal@gmail.com>
Date: Thu Mar 28 10:07:29 2024 +0100
patch 9.1.0215: Half-page scrolling does not support smooth-scrolling
Problem: Page-wise scrolling with Ctrl-D/Ctrl-U implements
it's own logic to change the topline and cursor.
More logic than necessary for scrolling with Ctrl-F/Ctrl-B
was removed in patch 9.1.0211.
Solution: Re-use the logic from Ctrl-E/Ctrl-Y/Ctrl-F/Ctrl-B while
staying backward compatible as much as possible.
Restore some of the logic that determined how many lines will
be scrolled (Luuk van Baal)
closes: #14316
Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
author | Christian Brabandt <cb@256bit.org> |
---|---|
date | Thu, 28 Mar 2024 10:15:08 +0100 |
parents | 8079960136db |
children | 5569220366ee |
line wrap: on
line diff
--- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -1280,9 +1280,13 @@ func Test_vert_scroll_cmds() exe "normal \<C-D>" call assert_equal(46, line('.')) exe "normal \<C-U>" - call assert_equal(36, line('.')) + call assert_equal(36, line('w0')) + call assert_equal(46, line('.')) exe "normal \<C-U>" - call assert_equal(10, line('.')) + call assert_equal(1, line('w0')) + call assert_equal(40, line('.')) + exe "normal \<C-U>" + call assert_equal(30, line('.')) exe "normal \<C-U>" call assert_equal(1, line('.')) set scroll& @@ -1303,9 +1307,8 @@ func Test_vert_scroll_cmds() call assert_equal(50, line('.')) call assert_equal(100, line('w$')) normal z. - let lnum = winline() exe "normal \<C-D>" - call assert_equal(lnum, winline()) + call assert_equal(1, winline()) call assert_equal(50, line('.')) normal zt exe "normal \<C-D>" @@ -3066,7 +3069,8 @@ func Test_normal42_halfpage() call assert_equal(2, &scroll) set scroll=5 exe "norm! \<c-u>" - call assert_equal('3', getline('.')) + call assert_equal('3', getline('w0')) + call assert_equal('8', getline('.')) 1 set scrolloff=5 exe "norm! \<c-d>" @@ -3813,11 +3817,11 @@ func Test_normal_vert_scroll_longline() call assert_equal(11, line('.')) call assert_equal(1, winline()) exe "normal \<C-B>" - call assert_equal(11, line('.')) - call assert_equal(9, winline()) + call assert_equal(10, line('.')) + call assert_equal(10, winline()) exe "normal \<C-B>\<C-B>" call assert_equal(5, line('.')) - call assert_equal(1, winline()) + call assert_equal(5, winline()) bwipe! endfunc @@ -4186,12 +4190,16 @@ func Test_single_line_scroll() norm! { call assert_equal([0, 1, 1, 0], getpos('.')) - " Ctrl-B scrolls up with hidden "above" virtual text. + " Ctrl-B/Ctrl-U scroll up with hidden "above" virtual text. set smoothscroll exe "normal \<C-E>" call assert_notequal(0, winsaveview().skipcol) exe "normal \<C-B>" call assert_equal(0, winsaveview().skipcol) + exe "normal \<C-E>" + call assert_notequal(0, winsaveview().skipcol) + exe "normal \<C-U>" + call assert_equal(0, winsaveview().skipcol) set smoothscroll& bw!