screen: make update_screen() the only entry point for redrawing

update_single_line() was only used for 'concealcursor'. But 'cursorline'
has very similiar characteristics (redraw both lines on move cursor
between lines) and works without its own special entry point to the
redraw subsystem.

Later on 'concealcursor' and 'cursorline' could share more logic, but for
now make the former use standard redrawWinline(). Make sure it is called
before update_screen(), so that it is immediately visible.

Get rid of update_prepare() and update_finish(), and all issues from
them and their callsites not being in sync with changes to
update_screen()
This commit is contained in:
Björn Linse
2019-01-10 23:34:13 +01:00
parent 3f10c5b533
commit 889f73e861
4 changed files with 39 additions and 83 deletions

View File

@@ -1246,6 +1246,25 @@ static void normal_redraw(NormalState *s)
update_topline();
validate_cursor();
// TODO(bfredl): this logic is only used for 'concealcursor', not
// 'cursorline'. Maybe we can eliminate this check (and in edit.c) by
// checking for 'concealcursor' wherever we check for 'cursorline'
if (s->conceal_update_lines
&& (s->conceal_old_cursor_line !=
s->conceal_new_cursor_line
|| conceal_cursor_line(curwin)
|| need_cursor_line_redraw)) {
if (s->conceal_old_cursor_line !=
s->conceal_new_cursor_line
&& s->conceal_old_cursor_line <=
curbuf->b_ml.ml_line_count) {
redrawWinline(curwin, s->conceal_old_cursor_line);
}
redrawWinline(curwin, s->conceal_new_cursor_line);
curwin->w_valid &= ~VALID_CROW;
}
if (VIsual_active) {
update_curbuf(INVERTED); // update inverted part
} else if (must_redraw) {
@@ -1281,22 +1300,6 @@ static void normal_redraw(NormalState *s)
may_clear_sb_text(); // clear scroll-back text on next msg
showruler(false);
if (s->conceal_update_lines
&& (s->conceal_old_cursor_line !=
s->conceal_new_cursor_line
|| conceal_cursor_line(curwin)
|| need_cursor_line_redraw)) {
if (s->conceal_old_cursor_line !=
s->conceal_new_cursor_line
&& s->conceal_old_cursor_line <=
curbuf->b_ml.ml_line_count) {
update_single_line(curwin, s->conceal_old_cursor_line);
}
update_single_line(curwin, s->conceal_new_cursor_line);
curwin->w_valid &= ~VALID_CROW;
}
setcursor();
}
@@ -7089,7 +7092,7 @@ static void n_opencmd(cmdarg_T *cap)
? OPENLINE_DO_COM : 0,
0)) {
if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) {
update_single_line(curwin, oldline);
redrawWinline(curwin, oldline);
}
if (curwin->w_p_cul) {
// force redraw of cursorline