diff options
author | bfredl <bjorn.linse@gmail.com> | 2023-03-16 13:56:05 +0100 |
---|---|---|
committer | bfredl <bjorn.linse@gmail.com> | 2023-03-16 13:56:05 +0100 |
commit | 8021300806e2ccf04b3ec33970b682ee3c7a9cc3 (patch) | |
tree | cd4b6ed77b3f0cfc8ba57466d7a871920116f1d4 /src/nvim/marktree.c | |
parent | 320cb344c14b30f8c1aa8c2d86803e4c2f971ae9 (diff) | |
download | rneovim-8021300806e2ccf04b3ec33970b682ee3c7a9cc3.tar.gz rneovim-8021300806e2ccf04b3ec33970b682ee3c7a9cc3.tar.bz2 rneovim-8021300806e2ccf04b3ec33970b682ee3c7a9cc3.zip |
refactor(extmarks): some minor internal API changes
extranges and a bunch of other improvements are coming for 0.10
This gets in some minor surrounding API changes to avoid rebase
conflicts until then.
- decorations will be able to be specific to windows
- adjust deletion API to fit with extranges
Diffstat (limited to 'src/nvim/marktree.c')
-rw-r--r-- | src/nvim/marktree.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/nvim/marktree.c b/src/nvim/marktree.c index cb981bb00c..7e900bafa2 100644 --- a/src/nvim/marktree.c +++ b/src/nvim/marktree.c @@ -279,13 +279,13 @@ void marktree_put_key(MarkTree *b, mtkey_t k) /// 6. If 4 went all the way to the root node. The root node /// might have ended up with size 0. Delete it then. /// -/// NB: ideally keeps the iterator valid. Like point to the key after this -/// if present. +/// The iterator remains valid, and now points at the key _after_ the deleted +/// one. /// /// @param rev should be true if we plan to iterate _backwards_ and delete /// stuff before this key. Most of the time this is false (the /// recommended strategy is to always iterate forward) -void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) +uint64_t marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) { int adjustment = 0; @@ -294,6 +294,12 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) uint64_t id = mt_lookup_key(cur->key[curi]); // fprintf(stderr, "\nDELET %lu\n", id); + mtkey_t raw = rawkey(itr); + uint64_t other = 0; + if (mt_paired(raw)) { + other = mt_lookup_id(raw.ns, raw.id, !mt_end(raw)); + } + if (itr->node->level) { if (rev) { abort(); @@ -442,6 +448,8 @@ void marktree_del_itr(MarkTree *b, MarkTreeIter *itr, bool rev) marktree_itr_next(b, itr); } } + + return other; } static mtnode_t *merge_node(MarkTree *b, mtnode_t *p, int i) |