aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/window.c
diff options
context:
space:
mode:
authorBjörn Linse <bjorn.linse@gmail.com>2018-10-20 23:43:47 +0200
committerBjörn Linse <bjorn.linse@gmail.com>2018-10-22 11:59:02 +0200
commite598811e76a4ee6666b680545097fb06b0ba59aa (patch)
tree73553d90c1c010bcbe0e8cfef6edf97c61e671be /src/nvim/window.c
parent565bbd1485a4c884dbfdb65b8b1c04a0c5da6b3e (diff)
downloadrneovim-e598811e76a4ee6666b680545097fb06b0ba59aa.tar.gz
rneovim-e598811e76a4ee6666b680545097fb06b0ba59aa.tar.bz2
rneovim-e598811e76a4ee6666b680545097fb06b0ba59aa.zip
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.
Diffstat (limited to 'src/nvim/window.c')
-rw-r--r--src/nvim/window.c24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/nvim/window.c b/src/nvim/window.c
index e541e4bb68..56caf7a941 100644
--- a/src/nvim/window.c
+++ b/src/nvim/window.c
@@ -1265,7 +1265,8 @@ static void win_exchange(long Prenum)
(void)win_comp_pos(); /* recompute window positions */
win_enter(wp, true);
- redraw_later(CLEAR);
+ redraw_later(NOT_VALID);
+ redraw_win_later(wp, NOT_VALID);
}
/*
@@ -1340,7 +1341,7 @@ static void win_rotate(int upwards, int count)
(void)win_comp_pos();
}
- redraw_later(CLEAR);
+ redraw_all_later(NOT_VALID);
}
/*
@@ -1477,10 +1478,10 @@ static void win_equal_rec(
|| topfr->fr_width != width || topfr->fr_win->w_wincol != col
) {
topfr->fr_win->w_winrow = row;
- frame_new_height(topfr, height, FALSE, FALSE);
+ frame_new_height(topfr, height, false, false);
topfr->fr_win->w_wincol = col;
- frame_new_width(topfr, width, FALSE, FALSE);
- redraw_all_later(CLEAR);
+ frame_new_width(topfr, width, false, false);
+ redraw_all_later(NOT_VALID);
}
} else if (topfr->fr_layout == FR_ROW) {
topfr->fr_width = width;
@@ -3105,7 +3106,7 @@ int win_new_tabpage(int after, char_u *filename)
newtp->tp_topframe = topframe;
last_status(FALSE);
- redraw_all_later(CLEAR);
+ redraw_all_later(NOT_VALID);
apply_autocmds(EVENT_WINNEW, NULL, NULL, false, curbuf);
apply_autocmds(EVENT_WINENTER, NULL, NULL, false, curbuf);
@@ -3310,10 +3311,9 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
trigger_enter_autocmds, trigger_leave_autocmds);
prevwin = next_prevwin;
- last_status(FALSE); /* status line may appear or disappear */
- (void)win_comp_pos(); /* recompute w_winrow for all windows */
- must_redraw = CLEAR; /* need to redraw everything */
- diff_need_scrollbind = TRUE;
+ last_status(false); // status line may appear or disappear
+ (void)win_comp_pos(); // recompute w_winrow for all windows
+ diff_need_scrollbind = true;
/* The tabpage line may have appeared or disappeared, may need to resize
* the frames for that. When the Vim window was resized need to update
@@ -3335,7 +3335,7 @@ static void enter_tabpage(tabpage_T *tp, buf_T *old_curbuf, int trigger_enter_au
apply_autocmds(EVENT_BUFENTER, NULL, NULL, FALSE, curbuf);
}
- redraw_all_later(CLEAR);
+ redraw_all_later(NOT_VALID);
}
/*
@@ -5443,7 +5443,7 @@ restore_snapshot (
win_comp_pos();
if (wp != NULL && close_curwin)
win_goto(wp);
- redraw_all_later(CLEAR);
+ redraw_all_later(NOT_VALID);
}
clear_snapshot(curtab, idx);
}