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.
This commit is contained in:
Luuk van Baal
2023-12-13 23:30:19 +01:00
committed by Lewis Russell
parent aa05133b0e
commit 320e9c1c21
2 changed files with 20 additions and 13 deletions

View File

@@ -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;