mirror of
https://github.com/neovim/neovim.git
synced 2025-09-18 17:28:23 +00:00
bufhl: simplify redraw logic
using changed_lines_buf was technically incorrect, as the buffer wasn't modififed.
This commit is contained in:
@@ -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
|
||||||
|
Reference in New Issue
Block a user