diff options
author | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2019-07-20 18:28:16 -0400 |
---|---|---|
committer | Jan Edmund Lazo <jan.lazo@mail.utoronto.ca> | 2020-12-25 19:25:30 -0500 |
commit | 0519a75f6eca1065a4d0184f99c71ae03a99b9b1 (patch) | |
tree | 16f28a8a5e9768079cabd97c379d14962232b6d7 /src/nvim/screen.c | |
parent | 84faeb07d0018c674c2bc730333fefae6123f366 (diff) | |
download | rneovim-0519a75f6eca1065a4d0184f99c71ae03a99b9b1.tar.gz rneovim-0519a75f6eca1065a4d0184f99c71ae03a99b9b1.tar.bz2 rneovim-0519a75f6eca1065a4d0184f99c71ae03a99b9b1.zip |
vim-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)
https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 23 |
1 files changed, 17 insertions, 6 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index afabbe6afc..b4b358052b 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -6557,6 +6557,21 @@ 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. // @@ -6588,12 +6603,8 @@ int showmode(void) || restart_edit || 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; |