]> granicus.if.org Git - vim/commitdiff
patch 9.0.0469: cursor moves if cmdwin is closed when 'splitscroll' is off v9.0.0469
authorLuuk van Baal <luukvbaal@gmail.com>
Thu, 15 Sep 2022 11:43:26 +0000 (12:43 +0100)
committerBram Moolenaar <Bram@vim.org>
Thu, 15 Sep 2022 11:43:26 +0000 (12:43 +0100)
Problem:    Cursor moves if cmdwin is closed when 'splitscroll' is off.
Solution:   Skip win_fix_cursor if called when cmdwin is open or closing.
            (Luuk van Baal, closes #11134)

src/ex_getln.c
src/globals.h
src/version.c
src/window.c

index 4a5ac318e95196b00b7bc5bc29d2a165bf646ad8..70436b31f05e7546813ce55c59006ac3ff40ce13 100644 (file)
@@ -4405,7 +4405,6 @@ 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
@@ -4645,10 +4644,8 @@ open_cmdwin(void)
        wp = curwin;
        set_bufref(&bufref, curbuf);
 
-       save_p_spsc = p_spsc;
-       p_spsc = TRUE;
+       skip_win_fix_cursor = TRUE;
        win_goto(old_curwin);
-       p_spsc = save_p_spsc;
 
        // win_goto() may trigger an autocommand that already closes the
        // cmdline window.
@@ -4662,6 +4659,7 @@ open_cmdwin(void)
 
        // Restore window sizes.
        win_size_restore(&winsizes);
+       skip_win_fix_cursor = FALSE;
     }
 
     ga_clear(&winsizes);
index 521832428a69793e7133767300d64306e475b36e..568d3b3c82be7a2911cdd2e80fa6431a85fc9228 100644 (file)
@@ -1737,3 +1737,8 @@ EXTERN int channel_need_redraw INIT(= FALSE);
 // While executing a regexp and set to OPTION_MAGIC_ON or OPTION_MAGIC_OFF this
 // overrules p_magic.  Otherwise set to OPTION_MAGIC_NOT_SET.
 EXTERN optmagic_T magic_overruled INIT(= OPTION_MAGIC_NOT_SET);
+
+#ifdef FEAT_CMDWIN
+// Skip win_fix_cursor() call for 'nosplitscroll' when cmdwin is closed.
+EXTERN int skip_win_fix_cursor INIT(= FALSE);
+#endif
index 82a21df039b3a70c27bb2802e1a86192fcbd0172..8b4efd7dbab9a33930e1a1c75f9d8f017d673160 100644 (file)
@@ -703,6 +703,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    469,
 /**/
     468,
 /**/
index 6fefcac7507bdebf179aff00cb70762af1541b8c..fc7b8df3b02e8aa5cb01312c0b49dc25632c6334 100644 (file)
@@ -6410,6 +6410,10 @@ win_fix_cursor(int normal)
 
     if (wp->w_buffer->b_ml.ml_line_count < wp->w_height)
        return;
+#ifdef FEAT_CMDWIN
+    if (skip_win_fix_cursor)
+       return;
+#endif
 
     so = MIN(wp->w_height / 2, so);
     // Check if cursor position is above topline or below botline.