diff src/misc1.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 30de89c1d090
children 23af483c4ceb
line wrap: on
line diff
--- a/src/misc1.c
+++ b/src/misc1.c
@@ -434,8 +434,15 @@ set_indent(
 		saved_cursor.col = (colnr_T)(s - newline);
 	}
 #ifdef FEAT_TEXT_PROP
-	adjust_prop_columns(curwin->w_cursor.lnum, (colnr_T)(p - oldline),
-					     ind_len - (colnr_T)(p - oldline));
+	{
+	    int added = ind_len - (colnr_T)(p - oldline);
+
+	    // When increasing indent this behaves like spaces were inserted at
+	    // the old indent, when decreasing indent it behaves like spaces
+	    // were deleted at the new indent.
+	    adjust_prop_columns(curwin->w_cursor.lnum,
+			(colnr_T)(added > 0 ? (p - oldline) : ind_len), added);
+	}
 #endif
 	retval = TRUE;
     }