0
0
mirror of https://github.com/vim/vim.git synced 2025-09-27 04:14:06 -04:00

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)
This commit is contained in:
mityu
2022-09-14 17:27:36 +01:00
committed by Bram Moolenaar
parent 702bd6c7c6
commit e697d48890
3 changed files with 13 additions and 2 deletions

View File

@@ -4405,6 +4405,7 @@ open_cmdwin(void)
int save_restart_edit = restart_edit; int save_restart_edit = restart_edit;
int save_State = State; int save_State = State;
int save_exmode = exmode_active; int save_exmode = exmode_active;
int save_p_spsc;
#ifdef FEAT_RIGHTLEFT #ifdef FEAT_RIGHTLEFT
int save_cmdmsg_rl = cmdmsg_rl; int save_cmdmsg_rl = cmdmsg_rl;
#endif #endif
@@ -4643,7 +4644,11 @@ open_cmdwin(void)
// First go back to the original window. // First go back to the original window.
wp = curwin; wp = curwin;
set_bufref(&bufref, curbuf); set_bufref(&bufref, curbuf);
save_p_spsc = p_spsc;
p_spsc = TRUE;
win_goto(old_curwin); win_goto(old_curwin);
p_spsc = save_p_spsc;
// win_goto() may trigger an autocommand that already closes the // win_goto() may trigger an autocommand that already closes the
// cmdline window. // cmdline window.

View File

@@ -1734,9 +1734,13 @@ func Test_splitscroll_with_splits()
above copen | wincmd j above copen | wincmd j
call assert_equal(win_screenpos(0)[0] - tabline, line("w0")) call assert_equal(win_screenpos(0)[0] - tabline, line("w0"))
" No scroll when opening cmdwin " No scroll when opening cmdwin, and no cursor move when closing
only | norm ggLq: " cmdwin.
only | norm ggL
let curpos = getcurpos()
norm q:
call assert_equal(1, line("w0")) call assert_equal(1, line("w0"))
call assert_equal(curpos, getcurpos())
" Scroll when cursor becomes invalid in insert mode " Scroll when cursor becomes invalid in insert mode
norm Lic norm Lic

View File

@@ -703,6 +703,8 @@ static char *(features[]) =
static int included_patches[] = static int included_patches[] =
{ /* Add new patch number below this line */ { /* Add new patch number below this line */
/**/
465,
/**/ /**/
464, 464,
/**/ /**/