diff src/ops.c @ 22282:5adb97bf0b32 v8.2.1690

patch 8.2.1690: text properties not adjusted for "I" in Visual block mode Commit: https://github.com/vim/vim/commit/8b51b7f0f17af149a8ce76e805050977857f9e50 Author: Bram Moolenaar <Bram@vim.org> Date: Tue Sep 15 21:34:18 2020 +0200 patch 8.2.1690: text properties not adjusted for "I" in Visual block mode Problem: Text properties not adjusted for "I" in Visual block mode. Solution: Call inserted_bytes().
author Bram Moolenaar <Bram@vim.org>
date Tue, 15 Sep 2020 21:45:04 +0200
parents 0416105e103b
children 9debc021e99e
line wrap: on
line diff
--- a/src/ops.c
+++ b/src/ops.c
@@ -481,6 +481,7 @@ block_insert(
     int		count = 0;	// extra spaces to replace a cut TAB
     int		spaces = 0;	// non-zero if cutting a TAB
     colnr_T	offset;		// pointer along new line
+    colnr_T	startcol;	// column where insert starts
     unsigned	s_len;		// STRLEN(s)
     char_u	*newp, *oldp;	// new, old lines
     linenr_T	lnum;		// loop var
@@ -553,9 +554,10 @@ block_insert(
 
 	// insert pre-padding
 	vim_memset(newp + offset, ' ', (size_t)spaces);
+	startcol = offset + spaces;
 
 	// copy the new text
-	mch_memmove(newp + offset + spaces, s, (size_t)s_len);
+	mch_memmove(newp + startcol, s, (size_t)s_len);
 	offset += s_len;
 
 	if (spaces && !bdp->is_short)
@@ -574,6 +576,10 @@ block_insert(
 
 	ml_replace(lnum, newp, FALSE);
 
+	if (b_insert)
+	    // correct any text properties
+	    inserted_bytes(lnum, startcol, s_len);
+
 	if (lnum == oap->end.lnum)
 	{
 	    // Set "']" mark to the end of the block instead of the end of