diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-26 13:41:01 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-15 17:58:35 +0800 |
commit | 95b8e2c55f7d119497ec4008e564b2520c6d5e9b (patch) | |
tree | de9b0a2919039e9d6a03067c6d8242e994488241 | |
parent | 9a3877ff9d4db15189b171b4a487d57768abf0a9 (diff) | |
download | rneovim-95b8e2c55f7d119497ec4008e564b2520c6d5e9b.tar.gz rneovim-95b8e2c55f7d119497ec4008e564b2520c6d5e9b.tar.bz2 rneovim-95b8e2c55f7d119497ec4008e564b2520c6d5e9b.zip |
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)
https://github.com/vim/vim/commit/cb574f415486adff645ce384979bfecf27f5be8c
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.
https://github.com/vim/vim/commit/944cc9ceba8868acd238264d4a3894803c566b37
-rw-r--r-- | src/nvim/edit.c | 2 | ||||
-rw-r--r-- | src/nvim/screen.c | 21 | ||||
-rw-r--r-- | test/functional/vimscript/null_spec.lua | 2 |
3 files changed, 17 insertions, 8 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 7ddff92632..ea64f2d544 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -4251,7 +4251,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) { + } else if (p_smd && !skip_showmode()) { msg(""); } // Exit Insert mode diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 609c2e3017..22126af163 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -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; diff --git a/test/functional/vimscript/null_spec.lua b/test/functional/vimscript/null_spec.lua index f23f00bcc5..2451da983e 100644 --- a/test/functional/vimscript/null_spec.lua +++ b/test/functional/vimscript/null_spec.lua @@ -135,7 +135,7 @@ describe('NULL', function() null_test('does not make Neovim crash when v:oldfiles gets assigned to that', ':let v:oldfiles = L|oldfiles', 0) null_expr_test('does not make complete() crash or error out', 'execute(":normal i\\<C-r>=complete(1, L)[-1]\\n")', - '', '\n', function() + 0, '', function() eq({''}, curbufmeths.get_lines(0, -1, false)) end) null_expr_test('is accepted by setmatches()', 'setmatches(L)', 0, 0) |