diff src/screen.c @ 15629:dd2e0b83a660

patch 8.1.0822: peeking and flushing output slows down execution commit https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c Author: Bram Moolenaar <Bram@vim.org> Date: Fri Jan 25 22:29:57 2019 +0100 patch 8.1.0822: peeking and flushing output slows down execution 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)
author Bram Moolenaar <Bram@vim.org>
date Fri, 25 Jan 2019 22:30:13 +0100
parents b440c7becbca
children 6f1c7e9a6393
line wrap: on
line diff
--- a/src/screen.c
+++ b/src/screen.c
@@ -10110,6 +10110,26 @@ screen_del_lines(
 }
 
 /*
+ * 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.
  *
  * If clear_cmdline is TRUE, clear the rest of the cmdline.
@@ -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;