mirror of
https://github.com/neovim/neovim.git
synced 2025-10-16 14:56:08 +00:00
perf(extmarks): avoid unnecessary invalidations for virt_text (#27435)
Invalidation of most w_valid flags isn't needed when adding or removing virtual text below cursor.
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
#include "nvim/ascii_defs.h"
|
||||
#include "nvim/buffer.h"
|
||||
#include "nvim/buffer_defs.h"
|
||||
#include "nvim/change.h"
|
||||
#include "nvim/decoration.h"
|
||||
#include "nvim/drawscreen.h"
|
||||
#include "nvim/extmark.h"
|
||||
@@ -91,15 +92,18 @@ 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)
|
||||
void decor_redraw(buf_T *buf, int row1, int row2, int col1, DecorInline decor)
|
||||
{
|
||||
if (decor.ext) {
|
||||
DecorVirtText *vt = decor.data.ext.vt;
|
||||
while (vt) {
|
||||
bool below = (vt->flags & kVTIsLines) && !(vt->flags & kVTLinesAbove);
|
||||
redraw_buf_line_later(buf, row1 + 1 + below, true);
|
||||
linenr_T vt_lnum = row1 + 1 + below;
|
||||
redraw_buf_line_later(buf, vt_lnum, true);
|
||||
if (vt->flags & kVTIsLines || vt->pos == kVPosInline) {
|
||||
changed_line_display_buf(buf);
|
||||
// changed_lines_redraw_buf(buf, vt_lnum, vt_lnum + 1, 0);
|
||||
colnr_T vt_col = vt->flags & kVTIsLines ? 0 : col1;
|
||||
changed_lines_invalidate_buf(buf, vt_lnum, vt_col, vt_lnum + 1, 0);
|
||||
}
|
||||
vt = vt->next;
|
||||
}
|
||||
@@ -190,9 +194,9 @@ void buf_put_decor_sh(buf_T *buf, DecorSignHighlight *sh, int row1, int row2)
|
||||
}
|
||||
}
|
||||
|
||||
void buf_decor_remove(buf_T *buf, int row1, int row2, DecorInline decor, bool free)
|
||||
void buf_decor_remove(buf_T *buf, int row1, int row2, int col1, DecorInline decor, bool free)
|
||||
{
|
||||
decor_redraw(buf, row1, row2, decor);
|
||||
decor_redraw(buf, row1, row2, col1, decor);
|
||||
if (decor.ext) {
|
||||
uint32_t idx = decor.data.ext.sh_idx;
|
||||
while (idx != DECOR_ID_INVALID) {
|
||||
|
Reference in New Issue
Block a user