vim-patch:partial: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)
cb574f4154

Omit inchar() change: it breaks too many tests.

N/A patches for version.c:

vim-patch:8.2.5170: tiny issues

Problem:    Tiny issues.
Solution:   Tiny improvements.
944cc9ceba
This commit is contained in:
zeertzjq
2022-06-26 13:41:01 +08:00
parent 9a3877ff9d
commit 95b8e2c55f
3 changed files with 17 additions and 8 deletions

View File

@@ -5821,6 +5821,19 @@ void grid_del_lines(ScreenGrid *grid, int row, int line_count, int end, int col,
}
}
/// @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().
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.
@@ -5850,12 +5863,8 @@ int showmode(void)
|| restart_edit != NUL
|| 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
}
bool nwr_save = need_wait_return;