vim-patch:8.1.2214: too much is redrawn when 'cursorline' is set

Problem:    Too much is redrawn when 'cursorline' is set.
Solution:   Don't do a complete redraw. (closes vim/vim#5079)
11a58af66f
This commit is contained in:
zeertzjq
2021-07-31 17:59:33 +08:00
parent 56b437a6c7
commit 68f0670dfc
3 changed files with 24 additions and 21 deletions

View File

@@ -1275,25 +1275,19 @@ static void normal_redraw(NormalState *s)
redrawWinline(curwin, curwin->w_cursor.lnum);
}
if (curwin->w_p_cul && curwin->w_p_wrap
&& (curwin->w_p_culopt_flags & CULOPT_SCRLINE)) {
must_redraw = NOT_VALID;
// Might need to update for 'cursorline'.
// When 'cursorlineopt' is "screenline" need to redraw always.
if (curwin->w_p_cul
&& (curwin->w_last_cursorline != curwin->w_cursor.lnum
|| (curwin->w_p_culopt_flags & CULOPT_SCRLINE))
&& !char_avail()) {
redraw_later(curwin, VALID);
}
if (VIsual_active) {
update_curbuf(INVERTED); // update inverted part
} else if (must_redraw) {
// Might need some more update for the cursorscreen line.
// TODO(vim): can we optimized this?
if (curwin->w_p_cul
&& curwin->w_p_wrap
&& (curwin->w_p_culopt_flags & CULOPT_SCRLINE)
&& !char_avail()) {
update_screen(VALID);
}
else {
update_screen(0);
}
update_screen(0);
} else if (redraw_cmdline || clear_cmdline) {
showmode();
}