diff options
author | bfredl <bjorn.linse@gmail.com> | 2024-01-12 14:38:18 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2024-01-22 19:03:32 +0100 |
commit | 9af2be292db3db7b28a6210263f719a6bbc4059f (patch) | |
tree | 25f53af8614a63ac80e4c56c45f9102e9ee8e5a2 /src/nvim/edit.c | |
parent | cb6320e13f9a4f13ec745ce0bc34203cfa7612d0 (diff) | |
download | rneovim-9af2be292db3db7b28a6210263f719a6bbc4059f.tar.gz rneovim-9af2be292db3db7b28a6210263f719a6bbc4059f.tar.bz2 rneovim-9af2be292db3db7b28a6210263f719a6bbc4059f.zip |
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.
Diffstat (limited to 'src/nvim/edit.c')
-rw-r--r-- | src/nvim/edit.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/edit.c b/src/nvim/edit.c index 1415f0ca35..25d2c964ed 100644 --- a/src/nvim/edit.c +++ b/src/nvim/edit.c @@ -41,6 +41,7 @@ #include "nvim/mapping.h" #include "nvim/mark.h" #include "nvim/mark_defs.h" +#include "nvim/marktree.h" #include "nvim/mbyte.h" #include "nvim/mbyte_defs.h" #include "nvim/memline.h" @@ -240,7 +241,7 @@ static void insert_enter(InsertState *s) // need to position cursor again when on a TAB and // when on a char with inline virtual text - if (gchar_cursor() == TAB || curbuf->b_virt_text_inline > 0) { + if (gchar_cursor() == TAB || buf_meta_total(curbuf, kMTMetaInline) > 0) { curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL); } @@ -3472,7 +3473,7 @@ static bool ins_esc(int *count, int cmdchar, bool nomove) may_trigger_modechanged(); // need to position cursor again when on a TAB and // when on a char with inline virtual text - if (gchar_cursor() == TAB || curbuf->b_virt_text_inline > 0) { + if (gchar_cursor() == TAB || buf_meta_total(curbuf, kMTMetaInline) > 0) { curwin->w_valid &= ~(VALID_WROW|VALID_WCOL|VALID_VIRTCOL); } |