commit 99e8b613760820199faac8ca101c5becd4b2374f
parent 0197f13ed4fa71700fb4b5577a1375e4f34e2ad6
Author: zeertzjq <zeertzjq@outlook.com>
Date: Wed, 17 Dec 2025 14:38:57 +0800
Merge pull request #37006 from janlazo/vim-8.2.1939
vim-patch:8.2.{1939,1941}
Diffstat:
2 files changed, 26 insertions(+), 0 deletions(-)
diff --git a/src/nvim/move.c b/src/nvim/move.c
@@ -259,6 +259,7 @@ void update_topline(win_T *wp)
// If there is no valid screen and when the window height is zero just use
// the cursor line.
if (!default_grid.chars || wp->w_view_height == 0) {
+ check_cursor_lnum(wp);
wp->w_topline = wp->w_cursor.lnum;
wp->w_botline = wp->w_topline;
wp->w_viewport_invalid = true;
diff --git a/test/old/testdir/test_ex_mode.vim b/test/old/testdir/test_ex_mode.vim
@@ -259,6 +259,31 @@ func Test_ex_mode_errors()
quit
endfunc
+func Test_ex_mode_with_global()
+ CheckNotGui
+ CheckFeature timers
+
+ " This will get stuck in Normal mode after the failed "J", use a timer to
+ " get going again.
+ let lines =<< trim END
+ " call ch_logfile('logfile', 'w')
+ pedit
+ func FeedQ(id)
+ call feedkeys('gQ', 't')
+ endfunc
+ call timer_start(10, 'FeedQ')
+ g/^/vi|HJ
+ call writefile(['done'], 'Xdidexmode')
+ qall!
+ END
+ call writefile(lines, 'Xexmodescript')
+ call assert_equal(1, RunVim([], [], '-e -s -S Xexmodescript'))
+ call assert_equal(['done'], readfile('Xdidexmode'))
+
+ call delete('Xdidexmode')
+ call delete('Xexmodescript')
+endfunc
+
func Test_ex_mode_count_overflow()
" The multiplication causes an integer overflow
CheckNotAsan