aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/testdir
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-16 07:25:16 +0800
committerzeertzjq <zeertzjq@outlook.com>2023-02-16 08:09:41 +0800
commit968cd1ed933c039b8d60b0110bc6b539c71e387d (patch)
tree07100b51218fc9888becb0613a00eebe76ff7d4a /src/nvim/testdir
parentf1c5887377c9ae547a7564ec4fc52d72656a974f (diff)
downloadrneovim-968cd1ed933c039b8d60b0110bc6b539c71e387d.tar.gz
rneovim-968cd1ed933c039b8d60b0110bc6b539c71e387d.tar.bz2
rneovim-968cd1ed933c039b8d60b0110bc6b539c71e387d.zip
vim-patch:9.0.1309: scrolling two lines with even line count and 'scrolloff' set
Problem: Scrolling two lines with even line count and 'scrolloff' set. Solution: Adjust how the topline is computed. (closes vim/vim#10545) https://github.com/vim/vim/commit/1d6539cf36a7b6d1afe76fb6316fe662f543bf60 Cherry-pick test_scroll_opt.vim changes from patch 8.2.1432. Co-authored-by: Bram Moolenaar <Bram@vim.org>
Diffstat (limited to 'src/nvim/testdir')
-rw-r--r--src/nvim/testdir/test_scroll_opt.vim20
-rw-r--r--src/nvim/testdir/test_scrollbind.vim4
2 files changed, 21 insertions, 3 deletions
diff --git a/src/nvim/testdir/test_scroll_opt.vim b/src/nvim/testdir/test_scroll_opt.vim
index 77920eb8b0..64f4ced470 100644
--- a/src/nvim/testdir/test_scroll_opt.vim
+++ b/src/nvim/testdir/test_scroll_opt.vim
@@ -1,5 +1,4 @@
" Test for reset 'scroll'
-"
func Test_reset_scroll()
let scr = &l:scroll
@@ -34,3 +33,22 @@ func Test_reset_scroll()
quit!
endfunc
+
+func Test_scolloff_even_line_count()
+ new
+ resize 6
+ setlocal scrolloff=3
+ call setline(1, range(20))
+ normal 2j
+ call assert_equal(1, getwininfo(win_getid())[0].topline)
+ normal j
+ call assert_equal(1, getwininfo(win_getid())[0].topline)
+ normal j
+ call assert_equal(2, getwininfo(win_getid())[0].topline)
+ normal j
+ call assert_equal(3, getwininfo(win_getid())[0].topline)
+
+ bwipe!
+endfunc
+
+" vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/nvim/testdir/test_scrollbind.vim b/src/nvim/testdir/test_scrollbind.vim
index 6c5488be05..f67a559c60 100644
--- a/src/nvim/testdir/test_scrollbind.vim
+++ b/src/nvim/testdir/test_scrollbind.vim
@@ -217,8 +217,8 @@ end of window 2
\ '7 line 02 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02',
\ '56789ABCDEFGHIJKLMNOPQRSTUVWXYZ 02',
\ 'UTSRQPONMLKJIHGREDCBA9876543210 02',
- \ '. line 11 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 11',
- \ '. line 11 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 11',
+ \ '. line 10 ZYXWVUTSRQPONMLKJIHGREDCBA9876543210 10',
+ \ '. line 10 0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ 10',
\ ''], getline(1, '$'))
enew!