]> granicus.if.org Git - vim/commitdiff
patch 9.0.0234: cannot make difference between :normal end and argument char v9.0.0234
authorBram Moolenaar <Bram@vim.org>
Sun, 21 Aug 2022 09:40:07 +0000 (10:40 +0100)
committerBram Moolenaar <Bram@vim.org>
Sun, 21 Aug 2022 09:40:07 +0000 (10:40 +0100)
Problem:    Cannot make difference between the end of :normal and a character
            in its argument.
Solution:   Add the "typebuf_was_empty" flag. (closes #10950)

src/getchar.c
src/globals.h
src/normal.c
src/version.c

index c7601ef6155d11b9cf3b558ac2af15199b9245a1..4134eb9a99964d817ed20f64723749f8cfaeb55c 100644 (file)
@@ -3056,7 +3056,10 @@ vgetorpeek(int advance)
     ++vgetc_busy;
 
     if (advance)
+    {
        KeyStuffed = FALSE;
+       typebuf_was_empty = FALSE;
+    }
 
     init_typebuf();
     start_stuff();
@@ -3361,6 +3364,10 @@ vgetorpeek(int advance)
 #ifdef FEAT_CMDWIN
                    tc = c;
 #endif
+                   // set a flag to indicate this wasn't a normal char
+                   if (advance)
+                       typebuf_was_empty = TRUE;
+
                    // return from main_loop()
                    if (pending_exmode_active)
                        exmode_active = EXMODE_NORMAL;
index 21fabdbb517c8c7fa04c7572a97b129b9b3aa9c9..99ecefbdde65749cab334f226b748545f8e1d69c 100644 (file)
@@ -1206,6 +1206,10 @@ EXTERN typebuf_T typebuf         // typeahead buffer
                    = {NULL, NULL, 0, 0, 0, 0, 0, 0, 0}
 #endif
                    ;
+// Flag used to indicate that vgetorpeek() returned a char like Esc when the
+// :normal argument was exhausted.
+EXTERN int     typebuf_was_empty INIT(= FALSE);
+
 EXTERN int     ex_normal_busy INIT(= 0);   // recursiveness of ex_normal()
 #ifdef FEAT_EVAL
 EXTERN int     in_feedkeys INIT(= 0);      // ex_normal_busy set in feedkeys()
index b1335a0373a6b5d89ca4af6f11236e70f2964cb8..0ce0d4e32eb0c071d483d72b4a2e06aad6ff8cba 100644 (file)
@@ -6808,11 +6808,11 @@ nv_esc(cmdarg_T *cap)
 #endif
     }
 #ifdef FEAT_CMDWIN
-    else if (cmdwin_type != 0 && ex_normal_busy)
+    else if (cmdwin_type != 0 && ex_normal_busy && typebuf_was_empty)
     {
        // When :normal runs out of characters while in the command line window
-       // vgetorpeek() will return ESC.  Exit the cmdline window to break the
-       // loop.
+       // vgetorpeek() will repeatedly return ESC.  Exit the cmdline window to
+       // break the loop.
        cmdwin_result = K_IGNORE;
        return;
     }
index 92b55eecbcb65179a6660a5fefbd3941bc5705d7..07b571d8fa8c77884118970966b3453aeaa23a86 100644 (file)
@@ -731,6 +731,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    234,
 /**/
     233,
 /**/