patch 9.0.0465: cursor moves when cmdwin is closed when 'splitscroll' is off
Problem: Cursor moves when cmdwin is closed when 'splitscroll' is off.
Solution: Temporarily set 'splitscroll' when jumping back to the original
window. (closes #11128)
diff --git a/src/ex_getln.c b/src/ex_getln.c
index f9226de..4a5ac31 100644
--- a/src/ex_getln.c
+++ b/src/ex_getln.c
@@ -4405,6 +4405,7 @@
int save_restart_edit = restart_edit;
int save_State = State;
int save_exmode = exmode_active;
+ int save_p_spsc;
#ifdef FEAT_RIGHTLEFT
int save_cmdmsg_rl = cmdmsg_rl;
#endif
@@ -4643,7 +4644,11 @@
// First go back to the original window.
wp = curwin;
set_bufref(&bufref, curbuf);
+
+ save_p_spsc = p_spsc;
+ p_spsc = TRUE;
win_goto(old_curwin);
+ p_spsc = save_p_spsc;
// win_goto() may trigger an autocommand that already closes the
// cmdline window.
diff --git a/src/testdir/test_window_cmd.vim b/src/testdir/test_window_cmd.vim
index c9f9caa..872e1ba 100644
--- a/src/testdir/test_window_cmd.vim
+++ b/src/testdir/test_window_cmd.vim
@@ -1734,9 +1734,13 @@
above copen | wincmd j
call assert_equal(win_screenpos(0)[0] - tabline, line("w0"))
- " No scroll when opening cmdwin
- only | norm ggLq:
+ " No scroll when opening cmdwin, and no cursor move when closing
+ " cmdwin.
+ only | norm ggL
+ let curpos = getcurpos()
+ norm q:
call assert_equal(1, line("w0"))
+ call assert_equal(curpos, getcurpos())
" Scroll when cursor becomes invalid in insert mode
norm Lic
diff --git a/src/version.c b/src/version.c
index 45afd9d..cea4b73 100644
--- a/src/version.c
+++ b/src/version.c
@@ -704,6 +704,8 @@
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 465,
+/**/
464,
/**/
463,