mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #9484 from bfredl/highlander
screen: make update_screen() the only entry point for redrawing
This commit is contained in:
commit
8853fca1fd
@ -1452,21 +1452,24 @@ ins_redraw (
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (must_redraw)
|
|
||||||
update_screen(0);
|
|
||||||
else if (clear_cmdline || redraw_cmdline)
|
|
||||||
showmode(); /* clear cmdline and show mode */
|
|
||||||
if ((conceal_update_lines
|
if ((conceal_update_lines
|
||||||
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
&& (conceal_old_cursor_line != conceal_new_cursor_line
|
||||||
|| conceal_cursor_line(curwin)))
|
|| conceal_cursor_line(curwin)))
|
||||||
|| need_cursor_line_redraw) {
|
|| need_cursor_line_redraw) {
|
||||||
if (conceal_old_cursor_line != conceal_new_cursor_line)
|
if (conceal_old_cursor_line != conceal_new_cursor_line) {
|
||||||
update_single_line(curwin, conceal_old_cursor_line);
|
redrawWinline(curwin, conceal_old_cursor_line);
|
||||||
update_single_line(curwin, conceal_new_cursor_line == 0
|
}
|
||||||
? curwin->w_cursor.lnum : conceal_new_cursor_line);
|
redrawWinline(curwin, conceal_new_cursor_line == 0
|
||||||
|
? curwin->w_cursor.lnum : conceal_new_cursor_line);
|
||||||
curwin->w_valid &= ~VALID_CROW;
|
curwin->w_valid &= ~VALID_CROW;
|
||||||
}
|
}
|
||||||
showruler(FALSE);
|
|
||||||
|
if (must_redraw) {
|
||||||
|
update_screen(0);
|
||||||
|
} else if (clear_cmdline || redraw_cmdline) {
|
||||||
|
showmode(); // clear cmdline and show mode
|
||||||
|
}
|
||||||
|
showruler(false);
|
||||||
setcursor();
|
setcursor();
|
||||||
emsg_on_display = FALSE; /* may remove error message now */
|
emsg_on_display = FALSE; /* may remove error message now */
|
||||||
}
|
}
|
||||||
|
@ -1246,6 +1246,25 @@ static void normal_redraw(NormalState *s)
|
|||||||
update_topline();
|
update_topline();
|
||||||
validate_cursor();
|
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) {
|
if (VIsual_active) {
|
||||||
update_curbuf(INVERTED); // update inverted part
|
update_curbuf(INVERTED); // update inverted part
|
||||||
} else if (must_redraw) {
|
} 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
|
may_clear_sb_text(); // clear scroll-back text on next msg
|
||||||
showruler(false);
|
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();
|
setcursor();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -7089,7 +7092,7 @@ static void n_opencmd(cmdarg_T *cap)
|
|||||||
? OPENLINE_DO_COM : 0,
|
? OPENLINE_DO_COM : 0,
|
||||||
0)) {
|
0)) {
|
||||||
if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) {
|
if (curwin->w_p_cole > 0 && oldline != curwin->w_cursor.lnum) {
|
||||||
update_single_line(curwin, oldline);
|
redrawWinline(curwin, oldline);
|
||||||
}
|
}
|
||||||
if (curwin->w_p_cul) {
|
if (curwin->w_p_cul) {
|
||||||
// force redraw of cursorline
|
// force redraw of cursorline
|
||||||
|
@ -482,25 +482,6 @@ void update_screen(int type)
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Prepare for updating one or more windows.
|
|
||||||
// Caller must check for "updating_screen" already set to avoid recursiveness.
|
|
||||||
static void update_prepare(void)
|
|
||||||
{
|
|
||||||
updating_screen = true;
|
|
||||||
start_search_hl();
|
|
||||||
}
|
|
||||||
|
|
||||||
// Finish updating one or more windows.
|
|
||||||
static void update_finish(void)
|
|
||||||
{
|
|
||||||
if (redraw_cmdline) {
|
|
||||||
showmode();
|
|
||||||
}
|
|
||||||
|
|
||||||
end_search_hl();
|
|
||||||
updating_screen = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
* Return TRUE if the cursor line in window "wp" may be concealed, according
|
||||||
* to the 'concealcursor' option.
|
* to the 'concealcursor' option.
|
||||||
@ -537,39 +518,6 @@ void conceal_check_cursor_line(void)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_single_line(win_T *wp, linenr_T lnum)
|
|
||||||
{
|
|
||||||
int row;
|
|
||||||
int j;
|
|
||||||
|
|
||||||
// Don't do anything if the screen structures are (not yet) valid.
|
|
||||||
if (linebuf_char == NULL || updating_screen) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (lnum >= wp->w_topline && lnum < wp->w_botline
|
|
||||||
&& foldedCount(wp, lnum, &win_foldinfo) == 0) {
|
|
||||||
update_prepare();
|
|
||||||
|
|
||||||
row = 0;
|
|
||||||
for (j = 0; j < wp->w_lines_valid; ++j) {
|
|
||||||
if (lnum == wp->w_lines[j].wl_lnum) {
|
|
||||||
init_search_hl(wp);
|
|
||||||
prepare_search_hl(wp, lnum);
|
|
||||||
update_window_hl(wp, false);
|
|
||||||
// allocate window grid if not already
|
|
||||||
win_grid_alloc(wp);
|
|
||||||
win_line(wp, lnum, row, row + wp->w_lines[j].wl_size, false, false);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
row += wp->w_lines[j].wl_size;
|
|
||||||
}
|
|
||||||
|
|
||||||
update_finish();
|
|
||||||
}
|
|
||||||
need_cursor_line_redraw = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update a single window.
|
* Update a single window.
|
||||||
|
@ -3542,11 +3542,13 @@ void win_goto(win_T *wp)
|
|||||||
|
|
||||||
win_enter(wp, true);
|
win_enter(wp, true);
|
||||||
|
|
||||||
/* Conceal cursor line in previous window, unconceal in current window. */
|
// Conceal cursor line in previous window, unconceal in current window.
|
||||||
if (win_valid(owp) && owp->w_p_cole > 0 && !msg_scrolled)
|
if (win_valid(owp) && owp->w_p_cole > 0 && !msg_scrolled) {
|
||||||
update_single_line(owp, owp->w_cursor.lnum);
|
redrawWinline(owp, owp->w_cursor.lnum);
|
||||||
if (curwin->w_p_cole > 0 && !msg_scrolled)
|
}
|
||||||
need_cursor_line_redraw = TRUE;
|
if (curwin->w_p_cole > 0 && !msg_scrolled) {
|
||||||
|
need_cursor_line_redraw = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user