]> granicus.if.org Git - vim/commitdiff
patch 8.0.1109: timer causes error on exit from Ex mode v8.0.1109
authorBram Moolenaar <Bram@vim.org>
Thu, 14 Sep 2017 20:55:37 +0000 (22:55 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 14 Sep 2017 20:55:37 +0000 (22:55 +0200)
Problem:    Timer causes error on exit from Ex mode. (xtal8)
Solution:   save and restore the ex_pressedreturn flag. (Christian Brabandt,
            closes #2079)

src/ex_cmds2.c
src/ex_docmd.c
src/proto/ex_docmd.pro
src/testdir/test_timers.vim
src/version.c

index 710a2789e8b4221c8074534bf3feac89657ba05f..f0a2a518d5cf3effc6f68a00a864c0c1ef20558e 100644 (file)
@@ -1224,6 +1224,7 @@ check_due_timer(void)
            int save_must_redraw = must_redraw;
            int save_trylevel = trylevel;
            int save_did_throw = did_throw;
+           int save_ex_pressedreturn = get_pressedreturn();
            except_T *save_current_exception = current_exception;
 
            /* Create a scope for running the timer callback, ignoring most of
@@ -1257,6 +1258,7 @@ check_due_timer(void)
                need_update_screen = TRUE;
            must_redraw = must_redraw > save_must_redraw
                                              ? must_redraw : save_must_redraw;
+           set_pressedreturn(save_ex_pressedreturn);
 
            /* Only fire the timer again if it repeats and stop_timer() wasn't
             * called while inside the callback (tr_id == -1). */
index 3c51b3aea6422bd82590b71a85a978875e2d6df0..e804e2a5db52d0ba5c87b6880e8e626637ef9e81 100644 (file)
@@ -12418,3 +12418,17 @@ ex_folddo(exarg_T *eap)
 #endif
 }
 #endif
+
+# if defined(FEAT_TIMERS) || defined(PROTO)
+    int
+get_pressedreturn(void)
+{
+    return ex_pressedreturn;
+}
+
+    void
+set_pressedreturn(int val)
+{
+     ex_pressedreturn = val;
+}
+#endif
index 1a931e5395f289aa9e083d534c9f151ab472b245..116ff4e7296bd6bac458f64e464b95f1fd80d17f 100644 (file)
@@ -63,4 +63,6 @@ void dialog_msg(char_u *buff, char *format, char_u *fname);
 char_u *get_behave_arg(expand_T *xp, int idx);
 char_u *get_messages_arg(expand_T *xp, int idx);
 char_u *get_mapclear_arg(expand_T *xp, int idx);
+int get_pressedreturn(void);
+void set_pressedreturn(int val);
 /* vim: set ft=c : */
index b5b9d67db1a4a9546835ee2595bf08b72f2ffcd8..768eeade8c658261c82b7f1948bb4646fa15db7c 100644 (file)
@@ -246,4 +246,15 @@ func Test_peek_and_get_char()
   call timer_stop(intr)
 endfunc
 
+func Test_ex_mode()
+  " Function with an empty line.
+  func Foo(...)
+
+  endfunc
+  let timer =  timer_start(40, function('g:Foo'), {'repeat':-1})
+  " This used to throw error E749.
+  exe "normal Qsleep 100m\rvi\r"
+  call timer_stop(timer)
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
index c8191cc41361ac06edc2ee09e3f4afd1afa2cfb5..c4a1adac5d185264ebcd652746e30853976ec6e5 100644 (file)
@@ -769,6 +769,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1109,
 /**/
     1108,
 /**/