]> granicus.if.org Git - vim/commitdiff
patch 8.2.0274: hang with combination of feedkeys(), Ex mode and :global v8.2.0274
authorBram Moolenaar <Bram@vim.org>
Tue, 18 Feb 2020 20:33:00 +0000 (21:33 +0100)
committerBram Moolenaar <Bram@vim.org>
Tue, 18 Feb 2020 20:33:00 +0000 (21:33 +0100)
Problem:    Hang with combination of feedkeys(), Ex mode and :global.
            (Yegappan Lakshmanan)
Solution:   Add the pending_exmode_active flag.

src/ex_docmd.c
src/getchar.c
src/globals.h
src/testdir/test_ex_mode.vim
src/version.c

index a819f64888b52d0ca80176be75453ea1f471b263..b78e5ac6669d734409942c93a9ea845e9807d78d 100644 (file)
@@ -6185,9 +6185,11 @@ do_exedit(
                hold_gui_events = 0;
 #endif
                must_redraw = CLEAR;
+               pending_exmode_active = TRUE;
 
                main_loop(FALSE, TRUE);
 
+               pending_exmode_active = FALSE;
                RedrawingDisabled = rd;
                no_wait_return = nwr;
                msg_scroll = ms;
index d056bcc5d16ec02555413e013ee310ead9cc758a..b828c27dd4b687841fba14e40e8be7de4f0dab11 100644 (file)
@@ -3041,6 +3041,10 @@ vgetorpeek(int advance)
 #ifdef FEAT_CMDWIN
                    tc = c;
 #endif
+                   // return from main_loop()
+                   if (pending_exmode_active)
+                       exmode_active = EXMODE_NORMAL;
+
                    break;
                }
 
index bda75b486eb8178e7991faba75720aa2d818cd48..fc551ba99691d24c03f3a558186f41f8f114d7f9 100644 (file)
@@ -1028,6 +1028,10 @@ EXTERN int       motion_force INIT(= 0); // motion force for pending operator
  * Ex mode (Q) state
  */
 EXTERN int exmode_active INIT(= 0);    // zero, EXMODE_NORMAL or EXMODE_VIM
+
+// Flag set when main_loop() should exit when entering Ex mode.
+EXTERN int pending_exmode_active INIT(= FALSE);
+
 EXTERN int ex_no_reprint INIT(= FALSE); // no need to print after z or p
 
 EXTERN int reg_recording INIT(= 0);    // register for recording  or zero
index bf101049849ef8bb6fb6294fc5914500ed1739f0..910c1a6377686165a5cabf9413eea4f5e56792af 100644 (file)
@@ -111,4 +111,12 @@ func Test_open_command()
   close!
 endfunc
 
+func Test_Ex_feedkeys()
+  " this doesn't do anything useful, just check it doesn't hang
+  new
+  call setline(1, ["foo"])
+  call feedkeys("Qg/foo/visual\<CR>", "xt")
+  bwipe!
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index 2fbccd29a2a19bb3ecf25c660f787e2f367f7937..679354768804bc79eb946acf36a4d1e09f893fad 100644 (file)
@@ -738,6 +738,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    274,
 /**/
     273,
 /**/