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/undo.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/undo.c')
-rw-r--r-- | src/nvim/undo.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/nvim/undo.c b/src/nvim/undo.c index d517f07b32..11ebbb9bf1 100644 --- a/src/nvim/undo.c +++ b/src/nvim/undo.c @@ -67,6 +67,7 @@ // Uncomment the next line for including the u_check() function. This warns // for errors in the debug information. // #define U_DEBUG 1 +#include "nvim/marktree.h" #define UH_MAGIC 0x18dade // value for uh_magic when in use #define UE_MAGIC 0xabc123 // value for ue_magic when in use @@ -2390,7 +2391,7 @@ static void u_undoredo(bool undo, bool do_buf_event) // may have SpellCap that should be removed or it needs to be // displayed. Schedule the next line for redrawing just in case. // Also just in case the line had a sign which needs to be removed. - if ((spell_check_window(curwin) || curbuf->b_signs_with_text) + if ((spell_check_window(curwin) || buf_meta_total(curbuf, kMTMetaSignText)) && bot <= curbuf->b_ml.ml_line_count) { redrawWinline(curwin, bot); } @@ -2431,7 +2432,7 @@ static void u_undoredo(bool undo, bool do_buf_event) int row3 = -1; // Tricky: ExtmarkSavePos may come after ExtmarkSplice which does call // buf_signcols_count_range() but then misses the yet unrestored marks. - if (curbuf->b_signcols.autom && curbuf->b_signs_with_text) { + if (curbuf->b_signcols.autom && buf_meta_total(curbuf, kMTMetaSignText)) { for (int i = 0; i < (int)kv_size(curhead->uh_extmark); i++) { ExtmarkUndoObject undo_info = kv_A(curhead->uh_extmark, i); if (undo_info.type == kExtmarkSplice) { |