aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorLuuk van Baal <luukvbaal@gmail.com>2024-01-17 13:31:07 +0100
committerLuuk van Baal <luukvbaal@gmail.com>2024-01-17 23:17:04 +0100
commit437d35dbf7d9ff6f6e561377f5d23d7e4ac4d565 (patch)
tree894e12d7a02b8889cc0fc3d6b249415572bb738c /src
parent4615d46f93fb0b15a427f428bb1e652b4ccb873b (diff)
downloadrneovim-437d35dbf7d9ff6f6e561377f5d23d7e4ac4d565.tar.gz
rneovim-437d35dbf7d9ff6f6e561377f5d23d7e4ac4d565.tar.bz2
rneovim-437d35dbf7d9ff6f6e561377f5d23d7e4ac4d565.zip
fix(extmarks): do not remove invalid marks from decor upon deletion
Diffstat (limited to 'src')
-rw-r--r--src/nvim/extmark.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c
index 0321a11b0f..73a54729f8 100644
--- a/src/nvim/extmark.c
+++ b/src/nvim/extmark.c
@@ -150,7 +150,11 @@ void extmark_del(buf_T *buf, MarkTreeIter *itr, MTKey key, bool restore)
}
if (mt_decor_any(key)) {
- buf_decor_remove(buf, key.pos.row, key2.pos.row, mt_decor(key), true);
+ if (mt_invalid(key)) {
+ decor_free(mt_decor(key));
+ } else {
+ buf_decor_remove(buf, key.pos.row, key2.pos.row, mt_decor(key), true);
+ }
}
// TODO(bfredl): delete it from current undo header, opportunistically?
@@ -393,10 +397,9 @@ void extmark_apply_undo(ExtmarkUndoObject undo_info, bool undo)
} else if (undo_info.type == kExtmarkSavePos) {
ExtmarkSavePos pos = undo_info.data.savepos;
if (undo) {
- if (pos.old_row >= 0) {
- extmark_setraw(curbuf, pos.mark, pos.old_row, pos.old_col);
- }
- if (pos.invalidated) {
+ if (pos.old_row >= 0
+ && extmark_setraw(curbuf, pos.mark, pos.old_row, pos.old_col)
+ && pos.invalidated) {
MarkTreeIter itr[1] = { 0 };
MTKey mark = marktree_lookup(curbuf->b_marktree, pos.mark, itr);
mt_itr_rawkey(itr).flags &= (uint16_t) ~MT_FLAG_INVALID;