aboutsummaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-03-28 10:20:45 +0100
committerLuuk van Baal <luukvbaal@gmail.com>2024-03-28 11:39:34 +0100
commit2f638c0ac6275bebacd12671481642fa43d7ba10 (patch)
tree670cc5d23f380742a3ffb979097ab2ca8d1b3b36 /test
parent4147302f4be3fe8a5dae3f20a336477cb5f507a4 (diff)
downloadrneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.tar.gz
rneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.tar.bz2
rneovim-2f638c0ac6275bebacd12671481642fa43d7ba10.zip
vim-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) https://github.com/vim/vim/commit/5a2e3ec9ac72b6e644fea4ebba7e632498296e2f
Diffstat (limited to 'test')
-rw-r--r--test/functional/legacy/matchparen_spec.lua2
-rw-r--r--test/old/testdir/test_edit.vim32
-rw-r--r--test/old/testdir/test_normal.vim26
-rw-r--r--test/old/testdir/test_scroll_opt.vim29
4 files changed, 59 insertions, 30 deletions
diff --git a/test/functional/legacy/matchparen_spec.lua b/test/functional/legacy/matchparen_spec.lua
index 7b3f7bd424..adbf15d2e3 100644
--- a/test/functional/legacy/matchparen_spec.lua
+++ b/test/functional/legacy/matchparen_spec.lua
@@ -19,7 +19,7 @@ describe('matchparen', function()
call cursor(5, 1)
]])
- feed('V<c-d><c-d>')
+ feed('V<c-d><c-d>3j')
screen:expect([[
{17:{} |
{17:}} |
diff --git a/test/old/testdir/test_edit.vim b/test/old/testdir/test_edit.vim
index 2d4314a276..ba084442d1 100644
--- a/test/old/testdir/test_edit.vim
+++ b/test/old/testdir/test_edit.vim
@@ -1312,15 +1312,15 @@ func Test_edit_PAGEUP_PAGEDOWN()
call feedkeys("i\<PageDown>\<esc>", 'tnix')
call assert_equal([0, 30, 1, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 30, 1, 0], getpos('.'))
+ call assert_equal([0, 29, 1, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 23, 1, 0], getpos('.'))
+ call assert_equal([0, 21, 1, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 15, 1, 0], getpos('.'))
+ call assert_equal([0, 13, 1, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
call assert_equal([0, 10, 1, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 10, 11, 0], getpos('.'))
+ call assert_equal([0, 2, 11, 0], getpos('.'))
" <S-Up> is the same as <PageUp>
" <S-Down> is the same as <PageDown>
call cursor(1, 1)
@@ -1335,28 +1335,28 @@ func Test_edit_PAGEUP_PAGEDOWN()
call feedkeys("i\<S-Down>\<esc>", 'tnix')
call assert_equal([0, 30, 1, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 30, 1, 0], getpos('.'))
+ call assert_equal([0, 29, 1, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 23, 1, 0], getpos('.'))
+ call assert_equal([0, 21, 1, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 15, 1, 0], getpos('.'))
+ call assert_equal([0, 13, 1, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
call assert_equal([0, 10, 1, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 10, 11, 0], getpos('.'))
+ call assert_equal([0, 2, 11, 0], getpos('.'))
set nostartofline
call cursor(30, 11)
norm! zt
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 30, 11, 0], getpos('.'))
+ call assert_equal([0, 29, 11, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 23, 11, 0], getpos('.'))
+ call assert_equal([0, 21, 11, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 15, 11, 0], getpos('.'))
+ call assert_equal([0, 13, 11, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
call assert_equal([0, 10, 11, 0], getpos('.'))
call feedkeys("A\<PageUp>\<esc>", 'tnix')
- call assert_equal([0, 10, 11, 0], getpos('.'))
+ call assert_equal([0, 2, 11, 0], getpos('.'))
call cursor(1, 1)
call feedkeys("A\<PageDown>\<esc>", 'tnix')
call assert_equal([0, 9, 11, 0], getpos('.'))
@@ -1373,15 +1373,15 @@ func Test_edit_PAGEUP_PAGEDOWN()
call cursor(30, 11)
norm! zt
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 30, 11, 0], getpos('.'))
+ call assert_equal([0, 29, 11, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 23, 11, 0], getpos('.'))
+ call assert_equal([0, 21, 11, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 15, 11, 0], getpos('.'))
+ call assert_equal([0, 13, 11, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
call assert_equal([0, 10, 11, 0], getpos('.'))
call feedkeys("A\<S-Up>\<esc>", 'tnix')
- call assert_equal([0, 10, 11, 0], getpos('.'))
+ call assert_equal([0, 2, 11, 0], getpos('.'))
call cursor(1, 1)
call feedkeys("A\<S-Down>\<esc>", 'tnix')
call assert_equal([0, 9, 11, 0], getpos('.'))
diff --git a/test/old/testdir/test_normal.vim b/test/old/testdir/test_normal.vim
index 644a632413..937f18aa69 100644
--- a/test/old/testdir/test_normal.vim
+++ b/test/old/testdir/test_normal.vim
@@ -1283,9 +1283,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&
@@ -1306,9 +1310,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>"
@@ -3077,7 +3080,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>"
@@ -3823,11 +3827,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
@@ -4196,12 +4200,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!
diff --git a/test/old/testdir/test_scroll_opt.vim b/test/old/testdir/test_scroll_opt.vim
index ebfed77214..fbc714d9cc 100644
--- a/test/old/testdir/test_scroll_opt.vim
+++ b/test/old/testdir/test_scroll_opt.vim
@@ -1008,18 +1008,39 @@ func Test_smoothscroll_page()
call setline(1, 'abcde '->repeat(150))
exe "norm! \<C-F>"
- call assert_equal(320, winsaveview().skipcol)
+ call assert_equal(400, winsaveview().skipcol)
exe "norm! \<C-F>"
- call assert_equal(640, winsaveview().skipcol)
+ call assert_equal(800, winsaveview().skipcol)
exe "norm! \<C-F>"
call assert_equal(880, winsaveview().skipcol)
exe "norm! \<C-B>"
- call assert_equal(560, winsaveview().skipcol)
+ call assert_equal(480, winsaveview().skipcol)
exe "norm! \<C-B>"
- call assert_equal(240, winsaveview().skipcol)
+ call assert_equal(80, winsaveview().skipcol)
exe "norm! \<C-B>"
call assert_equal(0, winsaveview().skipcol)
+ exe "norm! \<C-D>"
+ call assert_equal(200, winsaveview().skipcol)
+ exe "norm! \<C-D>"
+ call assert_equal(400, winsaveview().skipcol)
+ exe "norm! \<C-D>"
+ call assert_equal(600, winsaveview().skipcol)
+ exe "norm! \<C-D>"
+ call assert_equal(800, winsaveview().skipcol)
+ exe "norm! \<C-D>"
+ call assert_equal(880, winsaveview().skipcol)
+ exe "norm! \<C-U>"
+ call assert_equal(680, winsaveview().skipcol)
+ exe "norm! \<C-U>"
+ call assert_equal(480, winsaveview().skipcol)
+ exe "norm! \<C-U>"
+ call assert_equal(280, winsaveview().skipcol)
+ exe "norm! \<C-U>"
+ call assert_equal(80, winsaveview().skipcol)
+ exe "norm! \<C-U>"
+ call assert_equal(0, winsaveview().skipcol)
+
set smoothscroll&
endfunc