patch 9.1.1297: Ctrl-D scrolling can get stuck

Commit: 
https://github.com/vim/vim/commit/c98250377d32007490da46b3334771ba3b2667fe
Author: Luuk van Baal <luukvb...@gmail.com>
Date:   Sun Apr 13 17:45:34 2025 +0200

    patch 9.1.1297: Ctrl-D scrolling can get stuck
    
    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 <luukvb...@gmail.com>
    Signed-off-by: Christian Brabandt <c...@256bit.org>

diff --git a/src/move.c b/src/move.c
index 5d34947a5..f4bce40d7 100644
--- a/src/move.c
+++ b/src/move.c
@@ -3120,6 +3120,7 @@ cursor_correct(void)
                            ~(VALID_WROW|VALID_WCOL|VALID_CHEIGHT|VALID_CROW);
        }
     }
+    check_cursor_moved(curwin);
     curwin->w_valid |= VALID_TOPLINE;
 }
 
diff --git a/src/testdir/test_normal.vim b/src/testdir/test_normal.vim
index 35c290c8d..aa24bceda 100644
--- a/src/testdir/test_normal.vim
+++ b/src/testdir/test_normal.vim
@@ -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
diff --git a/src/version.c b/src/version.c
index 6f3f24178..e95226cdc 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1297,
 /**/
     1296,
 /**/

-- 
-- 
You received this message from the "vim_dev" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

--- 
You received this message because you are subscribed to the Google Groups 
"vim_dev" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to vim_dev+unsubscr...@googlegroups.com.
To view this discussion visit 
https://groups.google.com/d/msgid/vim_dev/E1u3zkZ-000k0K-AG%40256bit.org.

Raspunde prin e-mail lui