From 78c51500f1bb16501521d721d52cb0982f5e70b6 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Tue, 9 Apr 2024 21:30:19 +0200 Subject: patch 9.1.0285: Still problems with cursor position for CTRL-D/U Problem: Problems with cursor position when scrolling half a page. Solution: Rework the cursor logic. (Luuk van Baal) closes: #14455 Signed-off-by: Luuk van Baal Signed-off-by: Christian Brabandt --- src/testdir/test_normal.vim | 12 ++++++++++++ src/testdir/test_scroll_opt.vim | 8 ++++---- 2 files changed, 16 insertions(+), 4 deletions(-) (limited to 'src/testdir') diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim index 5b1bb402b6..4f99095415 100644 --- a/src/testdir/test_normal.vim +++ b/src/testdir/test_normal.vim @@ -4225,4 +4225,16 @@ func Test_single_line_filler_zb() bw! endfunc +" Test for Ctrl-U not getting stuck at end of buffer with 'scrolloff'. +func Test_halfpage_scrolloff_eob() + set scrolloff=5 + + call setline(1, range(1, 100)) + exe "norm! Gzz\zz" + call assert_notequal(100, line('.')) + + set scrolloff& + bwipe! +endfunc + " vim: shiftwidth=2 sts=2 expandtab nofoldenable diff --git a/src/testdir/test_scroll_opt.vim b/src/testdir/test_scroll_opt.vim index e09c240a09..cda9bf0d78 100644 --- a/src/testdir/test_scroll_opt.vim +++ b/src/testdir/test_scroll_opt.vim @@ -1028,10 +1028,10 @@ func Test_smoothscroll_page() call assert_equal(415, col('.')) exe "norm! \" call assert_equal(520, winsaveview().skipcol) - call assert_equal(535, col('.')) + call assert_equal(615, col('.')) exe "norm! \" call assert_equal(520, winsaveview().skipcol) - call assert_equal(735, col('.')) + call assert_equal(815, col('.')) exe "norm! \" call assert_equal(520, winsaveview().skipcol) call assert_equal(895, col('.')) @@ -1043,10 +1043,10 @@ func Test_smoothscroll_page() call assert_equal(495, col('.')) exe "norm! \" call assert_equal(0, winsaveview().skipcol) - call assert_equal(375, col('.')) + call assert_equal(295, col('.')) exe "norm! \" call assert_equal(0, winsaveview().skipcol) - call assert_equal(175, col('.')) + call assert_equal(95, col('.')) exe "norm! \" call assert_equal(0, winsaveview().skipcol) call assert_equal(15, col('.')) -- cgit v1.2.3