summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-01-25 22:29:57 +0100
committerBram Moolenaar <Bram@vim.org>2019-01-25 22:29:57 +0100
commitcb574f415486adff645ce384979bfecf27f5be8c (patch)
tree7e3ffdb38c38d7b8c1c2c30bfbd9c86e369749ff
parent970f5d39f27717b1a529b7b250a8ed7c3f791949 (diff)
downloadvim-git-cb574f415486adff645ce384979bfecf27f5be8c.tar.gz
patch 8.1.0822: peeking and flushing output slows down executionv8.1.0822
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)
-rw-r--r--src/edit.c2
-rw-r--r--src/getchar.c5
-rw-r--r--src/proto/screen.pro1
-rw-r--r--src/screen.c32
-rw-r--r--src/version.c2
5 files changed, 29 insertions, 13 deletions
diff --git a/src/edit.c b/src/edit.c
index 92dbf4cb5..f797d7f04 100644
--- a/src/edit.c
+++ b/src/edit.c
@@ -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 */
diff --git a/src/getchar.c b/src/getchar.c
index ff1b06b02..fe74dbfa1 100644
--- a/src/getchar.c
+++ b/src/getchar.c
@@ -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
diff --git a/src/proto/screen.pro b/src/proto/screen.pro
index b78796e74..0657831db 100644
--- a/src/proto/screen.pro
+++ b/src/proto/screen.pro
@@ -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);
diff --git a/src/screen.c b/src/screen.c
index a80e8de65..9cdbf16b0 100644
--- 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;
diff --git a/src/version.c b/src/version.c
index ad2f5e7a7..4d7730cf5 100644
--- a/src/version.c
+++ b/src/version.c
@@ -788,6 +788,8 @@ static char *(features[]) =
static int included_patches[] =
{ /* Add new patch number below this line */
/**/
+ 822,
+/**/
821,
/**/
820,