mirror of
https://github.com/neovim/neovim.git
synced 2025-02-25 18:55:25 -06:00
Merge pull request #9479 from bfredl/redrawsign
screen: remove ad-hoc code path for redrawing signs.
This commit is contained in:
commit
1ca2c8950f
@ -5347,8 +5347,7 @@ int bufhl_add_hl(buf_T *buf,
|
|||||||
hlentry->stop = col_end;
|
hlentry->stop = col_end;
|
||||||
|
|
||||||
if (0 < lnum && lnum <= buf->b_ml.ml_line_count) {
|
if (0 < lnum && lnum <= buf->b_ml.ml_line_count) {
|
||||||
changed_lines_buf(buf, lnum, lnum+1, 0);
|
redraw_buf_line_later(buf, lnum);
|
||||||
redraw_buf_later(buf, VALID);
|
|
||||||
}
|
}
|
||||||
return src_id;
|
return src_id;
|
||||||
}
|
}
|
||||||
@ -5414,8 +5413,7 @@ int bufhl_add_virt_text(buf_T *buf,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (0 < lnum && lnum <= buf->b_ml.ml_line_count) {
|
if (0 < lnum && lnum <= buf->b_ml.ml_line_count) {
|
||||||
changed_lines_buf(buf, lnum, lnum+1, 0);
|
redraw_buf_line_later(buf, lnum);
|
||||||
redraw_buf_later(buf, VALID);
|
|
||||||
}
|
}
|
||||||
return src_id;
|
return src_id;
|
||||||
}
|
}
|
||||||
@ -5440,8 +5438,6 @@ void bufhl_clear_line_range(buf_T *buf,
|
|||||||
linenr_T line_start,
|
linenr_T line_start,
|
||||||
linenr_T line_end)
|
linenr_T line_end)
|
||||||
{
|
{
|
||||||
linenr_T first_changed = MAXLNUM, last_changed = -1;
|
|
||||||
|
|
||||||
kbitr_t(bufhl) itr;
|
kbitr_t(bufhl) itr;
|
||||||
BufhlLine *l, t = BUFHLLINE_INIT(line_start);
|
BufhlLine *l, t = BUFHLLINE_INIT(line_start);
|
||||||
if (!kb_itr_get(bufhl, &buf->b_bufhl_info, &t, &itr)) {
|
if (!kb_itr_get(bufhl, &buf->b_bufhl_info, &t, &itr)) {
|
||||||
@ -5456,12 +5452,7 @@ void bufhl_clear_line_range(buf_T *buf,
|
|||||||
if (line_start <= line) {
|
if (line_start <= line) {
|
||||||
BufhlLineStatus status = bufhl_clear_line(l, src_id, line);
|
BufhlLineStatus status = bufhl_clear_line(l, src_id, line);
|
||||||
if (status != kBLSUnchanged) {
|
if (status != kBLSUnchanged) {
|
||||||
if (line > last_changed) {
|
redraw_buf_line_later(buf, line);
|
||||||
last_changed = line;
|
|
||||||
}
|
|
||||||
if (line < first_changed) {
|
|
||||||
first_changed = line;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (status == kBLSDeleted) {
|
if (status == kBLSDeleted) {
|
||||||
kb_del_itr(bufhl, &buf->b_bufhl_info, &itr);
|
kb_del_itr(bufhl, &buf->b_bufhl_info, &itr);
|
||||||
@ -5469,11 +5460,6 @@ void bufhl_clear_line_range(buf_T *buf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (last_changed != -1) {
|
|
||||||
changed_lines_buf(buf, first_changed, last_changed+1, 0);
|
|
||||||
redraw_buf_later(buf, VALID);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Clear bufhl highlights from a given source group and given line
|
/// Clear bufhl highlights from a given source group and given line
|
||||||
|
@ -1567,7 +1567,7 @@ void edit_unputchar(void)
|
|||||||
curwin->w_wcol++;
|
curwin->w_wcol++;
|
||||||
}
|
}
|
||||||
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) {
|
if (pc_status == PC_STATUS_RIGHT || pc_status == PC_STATUS_LEFT) {
|
||||||
redrawWinline(curwin, curwin->w_cursor.lnum, false);
|
redrawWinline(curwin, curwin->w_cursor.lnum);
|
||||||
} else {
|
} else {
|
||||||
grid_puts(&curwin->w_grid, pc_bytes, pc_row - msg_scrolled, pc_col,
|
grid_puts(&curwin->w_grid, pc_bytes, pc_row - msg_scrolled, pc_col,
|
||||||
pc_attr);
|
pc_attr);
|
||||||
@ -1608,7 +1608,7 @@ static void undisplay_dollar(void)
|
|||||||
{
|
{
|
||||||
if (dollar_vcol >= 0) {
|
if (dollar_vcol >= 0) {
|
||||||
dollar_vcol = -1;
|
dollar_vcol = -1;
|
||||||
redrawWinline(curwin, curwin->w_cursor.lnum, false);
|
redrawWinline(curwin, curwin->w_cursor.lnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5980,7 +5980,7 @@ static void check_spell_redraw(void)
|
|||||||
linenr_T lnum = spell_redraw_lnum;
|
linenr_T lnum = spell_redraw_lnum;
|
||||||
|
|
||||||
spell_redraw_lnum = 0;
|
spell_redraw_lnum = 0;
|
||||||
redrawWinline(curwin, lnum, false);
|
redrawWinline(curwin, lnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5759,7 +5759,7 @@ void ex_sign(exarg_T *eap)
|
|||||||
id = buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum);
|
id = buf_findsign_id(curwin->w_buffer, curwin->w_cursor.lnum);
|
||||||
if (id > 0) {
|
if (id > 0) {
|
||||||
buf_delsign(curwin->w_buffer, id);
|
buf_delsign(curwin->w_buffer, id);
|
||||||
update_debug_sign(curwin->w_buffer, curwin->w_cursor.lnum);
|
redraw_buf_line_later(curwin->w_buffer, curwin->w_cursor.lnum);
|
||||||
} else {
|
} else {
|
||||||
EMSG(_("E159: Missing sign number"));
|
EMSG(_("E159: Missing sign number"));
|
||||||
}
|
}
|
||||||
@ -5788,7 +5788,7 @@ void ex_sign(exarg_T *eap)
|
|||||||
// ":sign unplace {id}": remove placed sign by number
|
// ":sign unplace {id}": remove placed sign by number
|
||||||
FOR_ALL_BUFFERS(buf) {
|
FOR_ALL_BUFFERS(buf) {
|
||||||
if ((lnum = buf_delsign(buf, id)) != 0) {
|
if ((lnum = buf_delsign(buf, id)) != 0) {
|
||||||
update_debug_sign(buf, lnum);
|
redraw_buf_line_later(buf, lnum);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@ -5888,7 +5888,7 @@ void ex_sign(exarg_T *eap)
|
|||||||
} else {
|
} else {
|
||||||
// ":sign unplace {id} file={fname}"
|
// ":sign unplace {id} file={fname}"
|
||||||
lnum = buf_delsign(buf, id);
|
lnum = buf_delsign(buf, id);
|
||||||
update_debug_sign(buf, lnum);
|
redraw_buf_line_later(buf, lnum);
|
||||||
}
|
}
|
||||||
} else if (sign_name != NULL) {
|
} else if (sign_name != NULL) {
|
||||||
// idx == SIGNCMD_PLACE
|
// idx == SIGNCMD_PLACE
|
||||||
@ -5910,7 +5910,7 @@ void ex_sign(exarg_T *eap)
|
|||||||
lnum = buf_change_sign_type(buf, id, sp->sn_typenr);
|
lnum = buf_change_sign_type(buf, id, sp->sn_typenr);
|
||||||
}
|
}
|
||||||
if (lnum > 0) {
|
if (lnum > 0) {
|
||||||
update_debug_sign(buf, lnum);
|
redraw_buf_line_later(buf, lnum);
|
||||||
} else {
|
} else {
|
||||||
EMSG2(_("E885: Not possible to change sign %s"), sign_name);
|
EMSG2(_("E885: Not possible to change sign %s"), sign_name);
|
||||||
}
|
}
|
||||||
|
@ -117,8 +117,8 @@ static void redraw_for_cursorline(win_T *wp)
|
|||||||
// "w_last_cursorline" may be outdated, worst case we redraw
|
// "w_last_cursorline" may be outdated, worst case we redraw
|
||||||
// too much. This is optimized for moving the cursor around in
|
// too much. This is optimized for moving the cursor around in
|
||||||
// the current window.
|
// the current window.
|
||||||
redrawWinline(wp, wp->w_last_cursorline, false);
|
redrawWinline(wp, wp->w_last_cursorline);
|
||||||
redrawWinline(wp, wp->w_cursor.lnum, false);
|
redrawWinline(wp, wp->w_cursor.lnum);
|
||||||
redraw_win_later(wp, VALID);
|
redraw_win_later(wp, VALID);
|
||||||
} else {
|
} else {
|
||||||
redraw_win_later(wp, SOME_VALID);
|
redraw_win_later(wp, SOME_VALID);
|
||||||
|
@ -214,6 +214,15 @@ void redraw_buf_later(buf_T *buf, int type)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void redraw_buf_line_later(buf_T *buf, linenr_T line)
|
||||||
|
{
|
||||||
|
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
||||||
|
if (wp->w_buffer == buf) {
|
||||||
|
redrawWinline(wp, line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Changed something in the current window, at buffer line "lnum", that
|
* Changed something in the current window, at buffer line "lnum", that
|
||||||
* requires that line and possibly other lines to be redrawn.
|
* requires that line and possibly other lines to be redrawn.
|
||||||
@ -225,12 +234,11 @@ void redraw_buf_later(buf_T *buf, int type)
|
|||||||
void
|
void
|
||||||
redrawWinline(
|
redrawWinline(
|
||||||
win_T *wp,
|
win_T *wp,
|
||||||
linenr_T lnum,
|
linenr_T lnum
|
||||||
int invalid /* window line height is invalid now */
|
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
int i;
|
if (lnum >= wp->w_topline
|
||||||
|
&& lnum < wp->w_botline) {
|
||||||
if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum) {
|
if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum) {
|
||||||
wp->w_redraw_top = lnum;
|
wp->w_redraw_top = lnum;
|
||||||
}
|
}
|
||||||
@ -238,13 +246,6 @@ redrawWinline(
|
|||||||
wp->w_redraw_bot = lnum;
|
wp->w_redraw_bot = lnum;
|
||||||
}
|
}
|
||||||
redraw_win_later(wp, VALID);
|
redraw_win_later(wp, VALID);
|
||||||
|
|
||||||
if (invalid) {
|
|
||||||
// A w_lines[] entry for this lnum has become invalid.
|
|
||||||
i = find_wl_entry(wp, lnum);
|
|
||||||
if (i >= 0) {
|
|
||||||
wp->w_lines[i].wl_valid = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -569,58 +570,6 @@ void update_single_line(win_T *wp, linenr_T lnum)
|
|||||||
need_cursor_line_redraw = false;
|
need_cursor_line_redraw = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
void update_debug_sign(const buf_T *const buf, const linenr_T lnum)
|
|
||||||
{
|
|
||||||
bool doit = false;
|
|
||||||
win_foldinfo.fi_level = 0;
|
|
||||||
|
|
||||||
// update/delete a specific mark
|
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
|
||||||
if (buf != NULL && lnum > 0) {
|
|
||||||
if (wp->w_buffer == buf && lnum >= wp->w_topline
|
|
||||||
&& lnum < wp->w_botline) {
|
|
||||||
if (wp->w_redraw_top == 0 || wp->w_redraw_top > lnum) {
|
|
||||||
wp->w_redraw_top = lnum;
|
|
||||||
}
|
|
||||||
if (wp->w_redraw_bot == 0 || wp->w_redraw_bot < lnum) {
|
|
||||||
wp->w_redraw_bot = lnum;
|
|
||||||
}
|
|
||||||
redraw_win_later(wp, VALID);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
redraw_win_later(wp, VALID);
|
|
||||||
}
|
|
||||||
if (wp->w_redr_type != 0) {
|
|
||||||
doit = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Return when there is nothing to do, screen updating is already
|
|
||||||
// happening (recursive call), messages on the screen or still starting up.
|
|
||||||
if (!doit
|
|
||||||
|| updating_screen
|
|
||||||
|| State == ASKMORE
|
|
||||||
|| State == HITRETURN
|
|
||||||
|| msg_scrolled
|
|
||||||
|| starting) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// update all windows that need updating
|
|
||||||
update_prepare();
|
|
||||||
|
|
||||||
FOR_ALL_WINDOWS_IN_TAB(wp, curtab) {
|
|
||||||
if (wp->w_redr_type != 0) {
|
|
||||||
update_window_hl(wp, wp->w_redr_type >= NOT_VALID);
|
|
||||||
win_update(wp);
|
|
||||||
}
|
|
||||||
if (wp->w_redr_status) {
|
|
||||||
win_redr_status(wp, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
update_finish();
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Update a single window.
|
* Update a single window.
|
||||||
|
Loading…
Reference in New Issue
Block a user