diff options
Diffstat (limited to 'src/nvim/screen.c')
-rw-r--r-- | src/nvim/screen.c | 37 |
1 files changed, 10 insertions, 27 deletions
diff --git a/src/nvim/screen.c b/src/nvim/screen.c index 9ed91fcd89..a7fd2bfcc6 100644 --- a/src/nvim/screen.c +++ b/src/nvim/screen.c @@ -620,7 +620,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 || redraw_mode) { + if (clear_cmdline || redraw_cmdline) { showmode(); } @@ -6559,28 +6559,12 @@ 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_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. -// If redraw_mode is true show or clear the mode. // Return the length of the message (0 if no message). int showmode(void) { @@ -6606,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; @@ -6727,11 +6715,10 @@ int showmode(void) need_clear = true; } - mode_displayed = true; - if (need_clear || clear_cmdline || redraw_mode) { + mode_displayed = TRUE; + if (need_clear || clear_cmdline) msg_clr_eos(); - } - msg_didout = false; // overwrite this message + msg_didout = FALSE; /* overwrite this message */ length = msg_col; msg_col = 0; msg_no_more = false; @@ -6740,9 +6727,6 @@ 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 emtpy or disabled @@ -6759,7 +6743,6 @@ int showmode(void) win_redr_ruler(last, true); } redraw_cmdline = false; - redraw_mode = false; clear_cmdline = false; return length; |