diff options
author | Luuk van Baal <luukvbaal@gmail.com> | 2023-12-13 23:30:19 +0100 |
---|---|---|
committer | Lewis Russell <me@lewisr.dev> | 2023-12-14 08:55:00 +0000 |
commit | 320e9c1c21817fd76b84345018661f70437fa4b5 (patch) | |
tree | 3f31bbdaba63c5e78227cdb8c4f36feb1f4af0e6 /src/nvim/extmark.c | |
parent | aa05133b0e4e2157275936c31adbbd5b739b716d (diff) | |
download | rneovim-320e9c1c21817fd76b84345018661f70437fa4b5.tar.gz rneovim-320e9c1c21817fd76b84345018661f70437fa4b5.tar.bz2 rneovim-320e9c1c21817fd76b84345018661f70437fa4b5.zip |
fix(extmark): only invalidate unpaired marks on deleted rows
Problem: Unpaired marks are invalidated if its column is deleted,
which may just be a "placeholder" column, e.g. for signs.
Solution: Only remove unpaired marks if its entire row is deleted.
Diffstat (limited to 'src/nvim/extmark.c')
-rw-r--r-- | src/nvim/extmark.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/nvim/extmark.c b/src/nvim/extmark.c index 92fbc6fb79..f914137ccc 100644 --- a/src/nvim/extmark.c +++ b/src/nvim/extmark.c @@ -332,9 +332,13 @@ void extmark_splice_delete(buf_T *buf, int l_row, colnr_T l_col, int u_row, coln if (endpos.row < 0) { endpos = mark.pos; } - if ((endpos.col <= u_col || (!u_col && endpos.row == mark.pos.row)) - && mark.pos.col >= l_col - && mark.pos.row >= l_row && endpos.row <= u_row - (u_col ? 0 : 1)) { + // Invalidate unpaired marks in deleted lines and paired marks whose entire + // range has been deleted. + if ((!mt_paired(mark) && mark.pos.row < u_row) + || (mt_paired(mark) + && (endpos.col <= u_col || (!u_col && endpos.row == mark.pos.row)) + && mark.pos.col >= l_col + && mark.pos.row >= l_row && endpos.row <= u_row - (u_col ? 0 : 1))) { if (mt_no_undo(mark)) { extmark_del(buf, itr, mark, true); continue; |