patch 8.1.1343: text properties not adjusted for Visual block mode delete
Problem: Text properties not adjusted for Visual block mode delete.
Solution: Call adjust_prop_columns(). (closes #4384)
diff --git a/src/ops.c b/src/ops.c
index 489c473..480516b 100644
--- a/src/ops.c
+++ b/src/ops.c
@@ -1916,10 +1916,9 @@
curwin->w_cursor.coladd = 0;
}
- /* n == number of chars deleted
- * If we delete a TAB, it may be replaced by several characters.
- * Thus the number of characters may increase!
- */
+ // "n" == number of chars deleted
+ // If we delete a TAB, it may be replaced by several characters.
+ // Thus the number of characters may increase!
n = bd.textlen - bd.startspaces - bd.endspaces;
oldp = ml_get(lnum);
newp = alloc_check((unsigned)STRLEN(oldp) + 1 - n);
@@ -1935,6 +1934,11 @@
STRMOVE(newp + bd.textcol + bd.startspaces + bd.endspaces, oldp);
/* replace the line */
ml_replace(lnum, newp, FALSE);
+
+#ifdef FEAT_TEXT_PROP
+ if (curbuf->b_has_textprop && n != 0)
+ adjust_prop_columns(lnum, bd.textcol, -n);
+#endif
}
check_cursor_col();