diff src/ops.c @ 16682:7847d281cbbf v8.1.1343

patch 8.1.1343: text properties not adjusted for Visual block mode delete commit https://github.com/vim/vim/commit/8055d17388736421d875dd4933c4c93d49a2ab58 Author: Bram Moolenaar <Bram@vim.org> Date: Fri May 17 22:57:26 2019 +0200 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 https://github.com/vim/vim/issues/4384)
author Bram Moolenaar <Bram@vim.org>
date Fri, 17 May 2019 23:00:05 +0200
parents c263acbbd961
children 23af483c4ceb
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -1916,10 +1916,9 @@ op_delete(oparg_T *oap)
 		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 @@ op_delete(oparg_T *oap)
 	    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();