aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/marktree.c
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2023-10-24 13:32:00 +0200
committerLuuk van Baal <luukvbaal@gmail.com>2023-11-08 02:53:49 +0100
commit4e6f559b8c5f77924fdbe2e5abd9c6aa8efad13f (patch)
tree758c87fba796537921e16c49bcd2c377e77e6506 /src/nvim/marktree.c
parent324fad1e88ba38c87db446418a96fd3170b7f392 (diff)
downloadrneovim-4e6f559b8c5f77924fdbe2e5abd9c6aa8efad13f.tar.gz
rneovim-4e6f559b8c5f77924fdbe2e5abd9c6aa8efad13f.tar.bz2
rneovim-4e6f559b8c5f77924fdbe2e5abd9c6aa8efad13f.zip
feat(extmarks): add 'invalidate' property to extmarks
Problem: No way to have extmarks automatically removed when the range it is attached to is deleted. Solution: Add new 'invalidate' property that will hide a mark when the entirety of its range is deleted. When "undo_restore" is set to false, delete the mark from the buffer instead.
Diffstat (limited to 'src/nvim/marktree.c')
-rw-r--r--src/nvim/marktree.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c
index 3df659b8e1..214d228b2c 100644
--- a/src/nvim/marktree.c
+++ b/src/nvim/marktree.c
@@ -1146,9 +1146,14 @@ void marktree_revise(MarkTree *b, MarkTreeIter *itr, uint8_t decor_level, MTKey
// TODO(bfredl): clean up this mess and re-instantiate &= and |= forms
// once we upgrade to a non-broken version of gcc in functionaltest-lua CI
rawkey(itr).flags = (uint16_t)(rawkey(itr).flags & (uint16_t) ~MT_FLAG_DECOR_MASK);
+ rawkey(itr).flags = (uint16_t)(rawkey(itr).flags & (uint16_t) ~MT_FLAG_INVALID);
rawkey(itr).flags = (uint16_t)(rawkey(itr).flags
| (uint16_t)(decor_level << MT_FLAG_DECOR_OFFSET)
- | (uint16_t)(key.flags & MT_FLAG_DECOR_MASK));
+ | (uint16_t)(key.flags & MT_FLAG_DECOR_MASK)
+ | (uint16_t)(key.flags & MT_FLAG_HL_EOL)
+ | (uint16_t)(key.flags & MT_FLAG_NO_UNDO)
+ | (uint16_t)(key.flags & MT_FLAG_INVALID)
+ | (uint16_t)(key.flags & MT_FLAG_INVALIDATE));
rawkey(itr).decor_full = key.decor_full;
rawkey(itr).hl_id = key.hl_id;
rawkey(itr).priority = key.priority;
@@ -2006,8 +2011,8 @@ 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)
{
- MTKey key = { { row, col }, ns, id, 0,
- mt_flags(right_gravity, 0, false), 0, NULL };
+ uint16_t flags = mt_flags(right_gravity, false, false, false, 0);
+ MTKey key = { { row, col }, ns, id, 0, flags, 0, NULL };
marktree_put(b, key, end_row, end_col, end_right);
}