]> granicus.if.org Git - vim/commitdiff
patch 9.0.0465: cursor moves when cmdwin is closed when 'splitscroll' is off v9.0.0465
authormityu <mityu.mail@gmail.com>
Wed, 14 Sep 2022 16:27:36 +0000 (17:27 +0100)
committerBram Moolenaar <Bram@vim.org>
Wed, 14 Sep 2022 16:27:36 +0000 (17:27 +0100)
Problem:    Cursor moves when cmdwin is closed when 'splitscroll' is off.
Solution:   Temporarily set 'splitscroll' when jumping back to the original
            window. (closes #11128)

src/ex_getln.c
src/testdir/test_window_cmd.vim
src/version.c

index f9226de6e4c5ca8ad0c67aebaf42f4d4846ec259..4a5ac318e95196b00b7bc5bc29d2a165bf646ad8 100644 (file)
@@ -4405,6 +4405,7 @@ open_cmdwin(void)
     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 @@ open_cmdwin(void)
        // 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.
index c9f9caa3472801092656d90056c740c71bde6ff6..872e1bac18af1e008f903792379f6edf0b386a61 100644 (file)
@@ -1734,9 +1734,13 @@ func Test_splitscroll_with_splits()
               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
index 45afd9d027aba1060eeebd608989d199c98a2df3..cea4b7387bd10254dc6e85464440d1601ad51aac 100644 (file)
@@ -703,6 +703,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    465,
 /**/
     464,
 /**/