diff options
author | zeertzjq <zeertzjq@outlook.com> | 2022-06-26 15:39:09 +0800 |
---|---|---|
committer | zeertzjq <zeertzjq@outlook.com> | 2022-08-15 17:58:35 +0800 |
commit | 93ba82183122b6b6e3d388d0e0fad4a538052803 (patch) | |
tree | 7020800bddbd1ec8c5e36a1319eeee1c2892c5e0 /src/nvim/screen.c | |
parent | 53b0688ac0cad5db4840bbed1d7e5ccac3a1ee42 (diff) | |
download | rneovim-93ba82183122b6b6e3d388d0e0fad4a538052803.tar.gz rneovim-93ba82183122b6b6e3d388d0e0fad4a538052803.tar.bz2 rneovim-93ba82183122b6b6e3d388d0e0fad4a538052803.zip |
vim-patch:8.1.1192: mode is not cleared when leaving Insert mode with mapped Esc
Problem: Mode is not cleared when leaving Insert mode with mapped Esc.
Solution: Clear the mode when redraw_cmdline is set. (closes vim/vim#4269)
https://github.com/vim/vim/commit/4c25bd785aa8b565bf973cbba12ed36b76daaa4f
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 22126af163..8cc597fa99 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -591,7 +591,7 @@ int update_screen(int type) // Clear or redraw the command line. Done last, because scrolling may // mess up the command line. - if (clear_cmdline || redraw_cmdline) { + if (clear_cmdline || redraw_cmdline || redraw_mode) { showmode(); } @@ -5828,18 +5828,19 @@ 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 + redraw_mode = 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. -// If clear_cmdline is false there may be a message there that needs to be -// cleared only if a mode is shown. -// Return the length of the message (0 if no message). +/// Show the current mode and ruler. +/// +/// If clear_cmdline is true, clear the rest of the cmdline. +/// If clear_cmdline is false there may be a message there that needs to be +/// cleared only if a mode is shown. +/// If redraw_mode is true show or clear the mode. +/// @return the length of the message (0 if no message). int showmode(void) { bool need_clear; @@ -5998,7 +5999,7 @@ int showmode(void) } mode_displayed = true; - if (need_clear || clear_cmdline) { + if (need_clear || clear_cmdline || redraw_mode) { msg_clr_eos(); } msg_didout = false; // overwrite this message @@ -6010,6 +6011,9 @@ int showmode(void) } else if (clear_cmdline && msg_silent == 0) { // Clear the whole command line. Will reset "clear_cmdline". msg_clr_cmdline(); + } else if (redraw_mode) { + msg_pos_mode(); + msg_clr_eos(); } // NB: also handles clearing the showmode if it was empty or disabled @@ -6027,6 +6031,7 @@ int showmode(void) win_redr_ruler(last, true); } redraw_cmdline = false; + redraw_mode = false; clear_cmdline = false; return length; |