refactor(decorations): more conservative redraw range

Problem:  Decor range is being redrawn unconditionally, negating the
          more conservative line redrawing that follows.
Solution: Get rid of unconditional redraw_buf_range_later() call.
This commit is contained in:
Luuk van Baal 2024-01-03 00:55:35 +01:00
parent 2dc439c672
commit e6ddceda31

View File

@ -93,20 +93,13 @@ void bufhl_add_hl_pos_offset(buf_T *buf, int src_id, int hl_id, lpos_T pos_start
void decor_redraw(buf_T *buf, int row1, int row2, DecorInline decor)
{
if (row2 >= row1) {
redraw_buf_range_later(buf, row1 + 1, row2 + 1);
}
if (decor.ext) {
DecorVirtText *vt = decor.data.ext.vt;
while (vt) {
if (vt->flags & kVTIsLines) {
redraw_buf_line_later(buf, row1 + 1 + ((vt->flags & kVTLinesAbove) ? 0 : 1), true);
bool below = (vt->flags & kVTIsLines) && !(vt->flags & kVTLinesAbove);
redraw_buf_line_later(buf, row1 + 1 + below, true);
if (vt->flags & kVTIsLines || vt->pos == kVPosInline) {
changed_line_display_buf(buf);
} else {
if (vt->pos == kVPosInline) {
changed_line_display_buf(buf);
}
}
vt = vt->next;
}