mirror of
https://github.com/neovim/neovim.git
synced 2025-10-05 09:26:30 +00:00
perf(extmarks): add metadata for efficient filtering of special decorations
This expands on the global "don't pay for what you don't use" rules for these special extmark decorations: - inline virtual text, which needs to be processed in plines.c when we calculate the size of text on screen - virtual lines, which are needed when calculating "filler" lines - signs, with text and/or highlights, both of which needs to be processed for the entire line already at the beginning of a line. This adds a count to each node of the marktree, for how many special marks of each kind can be found in the subtree for this node. This makes it possible to quickly skip over these extra checks, when working in regions of the buffer not containing these kind of marks, instead of before where this could just be skipped if the entire _buffer_ didn't contain such marks.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include "nvim/highlight_group.h"
|
||||
#include "nvim/indent.h"
|
||||
#include "nvim/mark_defs.h"
|
||||
#include "nvim/marktree.h"
|
||||
#include "nvim/match.h"
|
||||
#include "nvim/mbyte.h"
|
||||
#include "nvim/memline.h"
|
||||
@@ -1645,7 +1646,7 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
&decor_state);
|
||||
}
|
||||
|
||||
if (!has_foldtext && wp->w_buffer->b_virt_text_inline > 0) {
|
||||
if (!has_foldtext && buf_meta_total(wp->w_buffer, kMTMetaInline) > 0) {
|
||||
handle_inline_virtual_text(wp, &wlv, ptr - line);
|
||||
if (wlv.n_extra > 0 && wlv.virt_inline_hl_mode <= kHlModeReplace) {
|
||||
// restore search_attr and area_attr when n_extra is down to zero
|
||||
@@ -1662,9 +1663,8 @@ int win_line(win_T *wp, linenr_T lnum, int startrow, int endrow, int col_rows, s
|
||||
}
|
||||
}
|
||||
|
||||
int *area_attr_p
|
||||
= wlv.extra_for_extmark && wlv.virt_inline_hl_mode <= kHlModeReplace
|
||||
? &saved_area_attr : &area_attr;
|
||||
int *area_attr_p = wlv.extra_for_extmark && wlv.virt_inline_hl_mode <= kHlModeReplace
|
||||
? &saved_area_attr : &area_attr;
|
||||
|
||||
// handle Visual or match highlighting in this line
|
||||
if (wlv.vcol == wlv.fromcol
|
||||
|
Reference in New Issue
Block a user