mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
ui: disable clearing almost everywhere
Avoid clearing the screen in most situations. NOT_VALID should be equivalent to CLEAR unless some external force messed up the terminal, for these situations <c-l> and :mode will still clear the screen. Also eliminate some obsolete code in screen.c, that dealt with that in vim drawing window 1 can mess up window 2, but this never happens in nvim. But what about slow terminals? There is two common meanings in which a terminal is said to be "slow": Most commonly (and in the sense of vim:s nottyfast) it means low bandwidth for sending bytes from nvim to the terminal. If the screen is very similar before and after the update_screen(CLEAR) this change should reduce bandwidth. If the screen is quite different, but there is no new regions of contiguous whitespace, clearing doesn't reduce bandwidth significantly. If the new screen contains a lot of whitespace, it will depend of if vsplits are used or not: as long as there is no vsplits, ce is used to cheaply clear the rest of the line, so full-screen clear is not needed to reduce bandwith. However a left vsplit currently needs to be padded with whitespace all the way to the separator. It is possible ec (clear N chars) can be used to reduce bandwidth here if this is a problem. (All of this assumes that one doesn't set Normal guibg=... on a non-BCE terminal, if you do you are doomed regardless of this change). Slow can also mean that drawing pixels on the screen is slow. E-ink screens is a recent example. Avoiding clearing and redrawing the unchanged part of the screen will always improve performance in these cases.
This commit is contained in:
@@ -208,8 +208,8 @@ void do_exmode(int improved)
|
||||
return;
|
||||
|
||||
save_msg_scroll = msg_scroll;
|
||||
++RedrawingDisabled; /* don't redisplay the window */
|
||||
++no_wait_return; /* don't wait for return */
|
||||
RedrawingDisabled++; // don't redisplay the window
|
||||
no_wait_return++; // don't wait for return
|
||||
|
||||
MSG(_("Entering Ex mode. Type \"visual\" to go to Normal mode."));
|
||||
while (exmode_active) {
|
||||
@@ -253,10 +253,11 @@ void do_exmode(int improved)
|
||||
}
|
||||
}
|
||||
|
||||
--RedrawingDisabled;
|
||||
--no_wait_return;
|
||||
update_screen(CLEAR);
|
||||
need_wait_return = FALSE;
|
||||
RedrawingDisabled--;
|
||||
no_wait_return--;
|
||||
redraw_all_later(NOT_VALID);
|
||||
update_screen(NOT_VALID);
|
||||
need_wait_return = false;
|
||||
msg_scroll = save_msg_scroll;
|
||||
}
|
||||
|
||||
@@ -6857,7 +6858,8 @@ static void ex_tabs(exarg_T *eap)
|
||||
static void ex_mode(exarg_T *eap)
|
||||
{
|
||||
if (*eap->arg == NUL) {
|
||||
ui_refresh();
|
||||
must_redraw = CLEAR;
|
||||
ex_redraw(eap);
|
||||
} else {
|
||||
EMSG(_(e_screenmode));
|
||||
}
|
||||
@@ -6963,7 +6965,7 @@ do_exedit(
|
||||
no_wait_return = 0;
|
||||
need_wait_return = FALSE;
|
||||
msg_scroll = 0;
|
||||
must_redraw = CLEAR;
|
||||
redraw_all_later(NOT_VALID);
|
||||
|
||||
normal_enter(false, true);
|
||||
|
||||
@@ -7782,11 +7784,14 @@ static void ex_redraw(exarg_T *eap)
|
||||
p_lz = FALSE;
|
||||
validate_cursor();
|
||||
update_topline();
|
||||
update_screen(eap->forceit ? CLEAR :
|
||||
VIsual_active ? INVERTED :
|
||||
0);
|
||||
if (need_maketitle)
|
||||
if (eap->forceit) {
|
||||
redraw_all_later(NOT_VALID);
|
||||
}
|
||||
update_screen(eap->forceit ? NOT_VALID
|
||||
: VIsual_active ? INVERTED : 0);
|
||||
if (need_maketitle) {
|
||||
maketitle();
|
||||
}
|
||||
RedrawingDisabled = r;
|
||||
p_lz = p;
|
||||
|
||||
|
Reference in New Issue
Block a user