]> git.ipfire.org Git - thirdparty/vim.git/commitdiff
patch 9.1.1297: Ctrl-D scrolling can get stuck v9.1.1297
authorLuuk van Baal <luukvbaal@gmail.com>
Sun, 13 Apr 2025 15:45:34 +0000 (17:45 +0200)
committerChristian Brabandt <cb@256bit.org>
Sun, 13 Apr 2025 15:45:34 +0000 (17:45 +0200)
Problem:  cursor_correct() calculates a valid cursor position which
  is later changed by update_topline() and causes Ctrl-D
          scrolling to be stuck (Daniel Steinberg, after v9.1.0258).
Solution: Update the valid cursor position before validating topline
          (Luuk van Baal).

fixes: #17106
closes: #17110

Signed-off-by: Luuk van Baal <luukvbaal@gmail.com>
Signed-off-by: Christian Brabandt <cb@256bit.org>
src/move.c
src/testdir/test_normal.vim
src/version.c

index 5d34947a58e8fc3f9c637437de99e7b1bbe584f0..f4bce40d7bceb6b48c11654ea9c82e46564cd3e6 100644 (file)
@@ -3120,6 +3120,7 @@ cursor_correct(void)
                            ~(VALID_WROW|VALID_WCOL|VALID_CHEIGHT|VALID_CROW);
        }
     }
+    check_cursor_moved(curwin);
     curwin->w_valid |= VALID_TOPLINE;
 }
 
index 35c290c8d7163f8a8ad9d3bffcfc192362f50c49..aa24bceda5437616eed8f9a6b8107b4384b366b4 100644 (file)
@@ -4326,4 +4326,23 @@ func Test_normal_go()
   bwipe!
 endfunc
 
+" Test for Ctrl-D with 'scrolloff' and narrow window does not get stuck.
+func Test_scroll_longline_scrolloff()
+  11new
+  36vsplit
+  set scrolloff=5
+
+  call setline(1, ['']->repeat(5))
+  call setline(6, ['foo'->repeat(20)]->repeat(2))
+  call setline(8, ['bar'->repeat(30)])
+  call setline(9, ['']->repeat(5))
+  exe "normal! \<C-D>"
+  call assert_equal(6, line('w0'))
+  exe "normal! \<C-D>"
+  call assert_equal(7, line('w0'))
+
+  set scrolloff&
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab nofoldenable
index 6f3f241784bd6f86b3744abec7c0cd5c617d0166..e95226cdcd8689e1b238c6b9be44644233b4d594 100644 (file)
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1297,
 /**/
     1296,
 /**/