comparison 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
comparison
equal deleted inserted replaced
34664:af61243e5aeb 34665:ca2da8e8fb53
1278 exe "normal \<C-D>" 1278 exe "normal \<C-D>"
1279 call assert_equal(36, line('.')) 1279 call assert_equal(36, line('.'))
1280 exe "normal \<C-D>" 1280 exe "normal \<C-D>"
1281 call assert_equal(46, line('.')) 1281 call assert_equal(46, line('.'))
1282 exe "normal \<C-U>" 1282 exe "normal \<C-U>"
1283 call assert_equal(36, line('.')) 1283 call assert_equal(36, line('w0'))
1284 call assert_equal(46, line('.'))
1284 exe "normal \<C-U>" 1285 exe "normal \<C-U>"
1285 call assert_equal(10, line('.')) 1286 call assert_equal(1, line('w0'))
1287 call assert_equal(40, line('.'))
1288 exe "normal \<C-U>"
1289 call assert_equal(30, line('.'))
1286 exe "normal \<C-U>" 1290 exe "normal \<C-U>"
1287 call assert_equal(1, line('.')) 1291 call assert_equal(1, line('.'))
1288 set scroll& 1292 set scroll&
1289 1293
1290 " Test for scrolling to the top of the file with <C-U> and a fold 1294 " Test for scrolling to the top of the file with <C-U> and a fold
1301 normal z- 1305 normal z-
1302 exe "normal \<C-D>" 1306 exe "normal \<C-D>"
1303 call assert_equal(50, line('.')) 1307 call assert_equal(50, line('.'))
1304 call assert_equal(100, line('w$')) 1308 call assert_equal(100, line('w$'))
1305 normal z. 1309 normal z.
1306 let lnum = winline()
1307 exe "normal \<C-D>" 1310 exe "normal \<C-D>"
1308 call assert_equal(lnum, winline()) 1311 call assert_equal(1, winline())
1309 call assert_equal(50, line('.')) 1312 call assert_equal(50, line('.'))
1310 normal zt 1313 normal zt
1311 exe "normal \<C-D>" 1314 exe "normal \<C-D>"
1312 call assert_equal(50, line('w0')) 1315 call assert_equal(50, line('w0'))
1313 1316
3064 exe "norm! 2\<c-d>" 3067 exe "norm! 2\<c-d>"
3065 call assert_equal('8', getline('.')) 3068 call assert_equal('8', getline('.'))
3066 call assert_equal(2, &scroll) 3069 call assert_equal(2, &scroll)
3067 set scroll=5 3070 set scroll=5
3068 exe "norm! \<c-u>" 3071 exe "norm! \<c-u>"
3069 call assert_equal('3', getline('.')) 3072 call assert_equal('3', getline('w0'))
3073 call assert_equal('8', getline('.'))
3070 1 3074 1
3071 set scrolloff=5 3075 set scrolloff=5
3072 exe "norm! \<c-d>" 3076 exe "norm! \<c-d>"
3073 call assert_equal('10', getline('.')) 3077 call assert_equal('10', getline('.'))
3074 exe "norm! \<c-u>" 3078 exe "norm! \<c-u>"
3811 call assert_equal(6, line('.')) 3815 call assert_equal(6, line('.'))
3812 exe "normal \<C-F>\<C-F>" 3816 exe "normal \<C-F>\<C-F>"
3813 call assert_equal(11, line('.')) 3817 call assert_equal(11, line('.'))
3814 call assert_equal(1, winline()) 3818 call assert_equal(1, winline())
3815 exe "normal \<C-B>" 3819 exe "normal \<C-B>"
3816 call assert_equal(11, line('.')) 3820 call assert_equal(10, line('.'))
3817 call assert_equal(9, winline()) 3821 call assert_equal(10, winline())
3818 exe "normal \<C-B>\<C-B>" 3822 exe "normal \<C-B>\<C-B>"
3819 call assert_equal(5, line('.')) 3823 call assert_equal(5, line('.'))
3820 call assert_equal(1, winline()) 3824 call assert_equal(5, winline())
3821 3825
3822 bwipe! 3826 bwipe!
3823 endfunc 3827 endfunc
3824 3828
3825 " Test for jumping in a file using % 3829 " Test for jumping in a file using %
4184 4188
4185 call assert_equal([0, 1, 20, 0], getpos('.')) 4189 call assert_equal([0, 1, 20, 0], getpos('.'))
4186 norm! { 4190 norm! {
4187 call assert_equal([0, 1, 1, 0], getpos('.')) 4191 call assert_equal([0, 1, 1, 0], getpos('.'))
4188 4192
4189 " Ctrl-B scrolls up with hidden "above" virtual text. 4193 " Ctrl-B/Ctrl-U scroll up with hidden "above" virtual text.
4190 set smoothscroll 4194 set smoothscroll
4191 exe "normal \<C-E>" 4195 exe "normal \<C-E>"
4192 call assert_notequal(0, winsaveview().skipcol) 4196 call assert_notequal(0, winsaveview().skipcol)
4193 exe "normal \<C-B>" 4197 exe "normal \<C-B>"
4194 call assert_equal(0, winsaveview().skipcol) 4198 call assert_equal(0, winsaveview().skipcol)
4199 exe "normal \<C-E>"
4200 call assert_notequal(0, winsaveview().skipcol)
4201 exe "normal \<C-U>"
4202 call assert_equal(0, winsaveview().skipcol)
4195 4203
4196 set smoothscroll& 4204 set smoothscroll&
4197 bw! 4205 bw!
4198 endfunc 4206 endfunc
4199 4207