Skip to content

Commit e697d48

Browse files
mityubrammool
authored andcommitted
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)
1 parent 702bd6c commit e697d48

File tree

3 files changed

+13
-2
lines changed

3 files changed

+13
-2
lines changed

src/ex_getln.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4405,6 +4405,7 @@ open_cmdwin(void)
44054405
int save_restart_edit = restart_edit;
44064406
int save_State = State;
44074407
int save_exmode = exmode_active;
4408+
int save_p_spsc;
44084409
#ifdef FEAT_RIGHTLEFT
44094410
int save_cmdmsg_rl = cmdmsg_rl;
44104411
#endif
@@ -4643,7 +4644,11 @@ open_cmdwin(void)
46434644
// First go back to the original window.
46444645
wp = curwin;
46454646
set_bufref(&bufref, curbuf);
4647+
4648+
save_p_spsc = p_spsc;
4649+
p_spsc = TRUE;
46464650
win_goto(old_curwin);
4651+
p_spsc = save_p_spsc;
46474652

46484653
// win_goto() may trigger an autocommand that already closes the
46494654
// cmdline window.

src/testdir/test_window_cmd.vim

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1734,9 +1734,13 @@ func Test_splitscroll_with_splits()
17341734
above copen | wincmd j
17351735
call assert_equal(win_screenpos(0)[0] - tabline, line("w0"))
17361736

1737-
" No scroll when opening cmdwin
1738-
only | norm ggLq:
1737+
" No scroll when opening cmdwin, and no cursor move when closing
1738+
" cmdwin.
1739+
only | norm ggL
1740+
let curpos = getcurpos()
1741+
norm q:
17391742
call assert_equal(1, line("w0"))
1743+
call assert_equal(curpos, getcurpos())
17401744

17411745
" Scroll when cursor becomes invalid in insert mode
17421746
norm Lic

src/version.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -703,6 +703,8 @@ static char *(features[]) =
703703

704704
static int included_patches[] =
705705
{ /* Add new patch number below this line */
706+
/**/
707+
465,
706708
/**/
707709
464,
708710
/**/

0 commit comments

Comments
 (0)