From b01a60b1aaaa6152b58af96c5054f697bbc3a31e Mon Sep 17 00:00:00 2001 From: Jan Edmund Lazo Date: Thu, 31 Dec 2020 15:40:18 -0500 Subject: Revert "vim-patch:8.1.0822: peeking and flushing output slows down execution" This reverts commit 0519a75f6eca1065a4d0184f99c71ae03a99b9b1. --- src/nvim/edit.c | 2 +- src/nvim/getchar.c | 6 ++---- src/nvim/screen.c | 23 ++++++----------------- 3 files changed, 9 insertions(+), 22 deletions(-) (limited to 'src') diff --git a/src/nvim/edit.c b/src/nvim/edit.c index fb06fc8859..4546aa4419 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -7803,7 +7803,7 @@ static bool ins_esc(long *count, int cmdchar, bool nomove) // Otherwise remove the mode message. if (reg_recording != 0 || restart_edit != NUL) { showmode(); - } else if (p_smd && !skip_showmode()) { + } else if (p_smd) { MSG(""); } // Exit Insert mode diff --git a/src/nvim/getchar.c b/src/nvim/getchar.c index eddbdef739..2e2993ed26 100644 --- a/src/nvim/getchar.c +++ b/src/nvim/getchar.c @@ -2490,10 +2490,8 @@ int inchar( } // Always flush the output characters when getting input characters - // from the user and not just peeking. - if (wait_time == -1L || wait_time > 10L) { - ui_flush(); - } + // from the user. + ui_flush(); // Fill up to a third of the buffer, because each character may be // tripled below. diff --git a/src/nvim/screen.c b/src/nvim/screen.c index dcf6657de2..a7fd2bfcc6 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -6559,21 +6559,6 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col, return; } -// Return true when postponing displaying the mode message: when not redrawing -// or inside a mapping. -bool skip_showmode(void) -{ - // 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. // @@ -6605,8 +6590,12 @@ int showmode(void) || restart_edit || VIsual_active)); if (do_mode || reg_recording != 0) { - if (skip_showmode()) { - return 0; // show mode later + // 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; } nwr_save = need_wait_return; -- cgit