]> granicus.if.org Git - vim/commitdiff
patch 8.1.0822: peeking and flushing output slows down execution v8.1.0822
authorBram Moolenaar <Bram@vim.org>
Fri, 25 Jan 2019 21:29:57 +0000 (22:29 +0100)
committerBram Moolenaar <Bram@vim.org>
Fri, 25 Jan 2019 21:29:57 +0000 (22:29 +0100)
Problem:    Peeking and flushing output slows down execution.
Solution:   Do not update the mode message when global_busy is set.  Do not
            flush when only peeking for a character. (Ken Takata)

src/edit.c
src/getchar.c
src/proto/screen.pro
src/screen.c
src/version.c

index 92dbf4cb5111ec3524048cebe3abba3958ea3b82..f797d7f04e5183ecd207719bcbaf43c671a85adf 100644 (file)
@@ -8722,7 +8722,7 @@ ins_esc(
      */
     if (reg_recording != 0 || restart_edit != NUL)
        showmode();
-    else if (p_smd)
+    else if (p_smd && !skip_showmode())
        msg("");
 
     return TRUE;           /* exit Insert mode */
index ff1b06b02621d7ac2db1c3cc4e8804b8f3893188..fe74dbfa1cd8b5423eb531bc87d31cab527819e7 100644 (file)
@@ -3039,9 +3039,10 @@ inchar(
 
        /*
         * Always flush the output characters when getting input characters
-        * from the user.
+        * from the user and not just peeking.
         */
-       out_flush();
+       if (wait_time == -1L || wait_time > 10L)
+           out_flush();
 
        /*
         * Fill up to a third of the buffer, because each character may be
index b78796e7445cb5e60a8717905a3fe5af41c81adb..0657831db6641897a85c30652d2852b8399cc5f1 100644 (file)
@@ -49,6 +49,7 @@ int win_ins_lines(win_T *wp, int row, int line_count, int invalid, int mayclear)
 int win_del_lines(win_T *wp, int row, int line_count, int invalid, int mayclear, int clear_attr);
 int screen_ins_lines(int off, int row, int line_count, int end, int clear_attr, win_T *wp);
 int screen_del_lines(int off, int row, int line_count, int end, int force, int clear_attr, win_T *wp);
+int skip_showmode(void);
 int showmode(void);
 void unshowmode(int force);
 void clearmode(void);
index a80e8de65e2b3cb65d41eeb70a9bf5f5da9429c2..9cdbf16b09cdb63bd7fbc79f35d8b9228761fcc3 100644 (file)
@@ -10109,6 +10109,26 @@ screen_del_lines(
     return OK;
 }
 
+/*
+ * Return TRUE when postponing displaying the mode message: when not redrawing
+ * or inside a mapping.
+ */
+    int
+skip_showmode()
+{
+    // Call char_avail() only when we are going to show something, because it
+    // takes a bit of time.  redrawing() may also call char_avail_avail().
+    if (global_busy
+           || msg_silent != 0
+           || !redrawing()
+           || (char_avail() && !KeyTyped))
+    {
+       redraw_cmdline = TRUE;          // show mode later
+       return TRUE;
+    }
+    return FALSE;
+}
+
 /*
  * Show the current mode and ruler.
  *
@@ -10135,16 +10155,8 @@ showmode(void)
                || VIsual_active));
     if (do_mode || reg_recording != 0)
     {
-       /*
-        * Don't show mode right now, when not redrawing or inside a mapping.
-        * Call char_avail() only when we are going to show something, because
-        * it takes a bit of time.
-        */
-       if (!redrawing() || (char_avail() && !KeyTyped) || msg_silent != 0)
-       {
-           redraw_cmdline = TRUE;              /* show mode later */
-           return 0;
-       }
+       if (skip_showmode())
+           return 0;           // show mode later
 
        nwr_save = need_wait_return;
 
index ad2f5e7a7b63e8c1fb93e4df80f41de0f871ba67..4d7730cf55990a039139afe8f7ebe6a0f501c7cd 100644 (file)
@@ -787,6 +787,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    822,
 /**/
     821,
 /**/