From f3632e14e3a75114415050ab01c2d04a06036009 Mon Sep 17 00:00:00 2001 From: altermo <107814000+altermo@users.noreply.github.com> Date: Fri, 7 Jun 2024 17:33:40 +0200 Subject: feat: get/set namespace properties #28728 ref https://github.com/neovim/neovim/pull/28432 ref https://github.com/neovim/neovim/issues/28469 --- src/nvim/marktree.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/nvim/marktree.c') diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index 34d6cd118f..9e3005b6a3 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -2286,7 +2286,7 @@ static void marktree_itr_fix_pos(MarkTree *b, MarkTreeIter *itr) void marktree_put_test(MarkTree *b, uint32_t ns, uint32_t id, int row, int col, bool right_gravity, int end_row, int end_col, bool end_right, bool meta_inline) { - uint16_t flags = mt_flags(right_gravity, false, false, false, false); + uint16_t flags = mt_flags(right_gravity, false, false, false); // The specific choice is irrelevant here, we pick one counted decor // type to test the counting and filtering logic. flags |= meta_inline ? MT_FLAG_DECOR_VIRT_TEXT_INLINE : 0; -- cgit From 34ded4d97b78063f5174b0e8dfb9d9bafdcb3110 Mon Sep 17 00:00:00 2001 From: Luuk van Baal Date: Mon, 2 Sep 2024 16:21:34 +0200 Subject: fix(decor): exclude invalid marks from meta total Problem: Marktree meta count still includes invalidated marks, making guards that check the meta total ineffective. Solution: Revise marktree metadata when in/revalidating a mark. --- src/nvim/marktree.c | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) (limited to 'src/nvim/marktree.c') diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index 9e3005b6a3..555fef5bbd 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -446,7 +446,7 @@ static MTNode *marktree_alloc_node(MarkTree *b, bool internal) // really meta_inc[kMTMetaCount] static void meta_describe_key_inc(uint32_t *meta_inc, MTKey *k) { - if (!mt_end(*k)) { + if (!mt_end(*k) && !mt_invalid(*k)) { meta_inc[kMTMetaInline] += (k->flags & MT_FLAG_DECOR_VIRT_TEXT_INLINE) ? 1 : 0; meta_inc[kMTMetaLines] += (k->flags & MT_FLAG_DECOR_VIRT_LINES) ? 1 : 0; meta_inc[kMTMetaSignHL] += (k->flags & MT_FLAG_DECOR_SIGNHL) ? 1 : 0; @@ -774,14 +774,10 @@ uint64_t marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) return other; } -void marktree_revise_flags(MarkTree *b, MarkTreeIter *itr, uint16_t new_flags) +void marktree_revise_meta(MarkTree *b, MarkTreeIter *itr, MTKey old_key) { - uint32_t meta_old[4]; - meta_describe_key(meta_old, rawkey(itr)); - rawkey(itr).flags &= (uint16_t) ~MT_FLAG_EXTERNAL_MASK; - rawkey(itr).flags |= new_flags; - - uint32_t meta_new[4]; + uint32_t meta_old[4], meta_new[4]; + meta_describe_key(meta_old, old_key); meta_describe_key(meta_new, rawkey(itr)); if (!memcmp(meta_old, meta_new, sizeof(meta_old))) { -- cgit