summaryrefslogtreecommitdiffstats
path: root/src/ex_cmds.c
diff options
context:
space:
mode:
authorBram Moolenaar <Bram@vim.org>2019-05-19 15:19:57 +0200
committerBram Moolenaar <Bram@vim.org>2019-05-19 15:19:57 +0200
commit338dfdad3844ebb1ce1d56c421d1f698c086eb0c (patch)
tree92afa870c4fd44c0de47468149d64c42708c2aa8 /src/ex_cmds.c
parentdc6855af974f2ef553aceee619fadcb858e25d39 (diff)
patch 8.1.1351: text property wrong after :substitutev8.1.1351
Problem: Text property wrong after :substitute. Solution: Save for undo before changing any text properties.
Diffstat (limited to 'src/ex_cmds.c')
-rw-r--r--src/ex_cmds.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/ex_cmds.c b/src/ex_cmds.c
index 3c9166d424..964c4556c9 100644
--- a/src/ex_cmds.c
+++ b/src/ex_cmds.c
@@ -5187,6 +5187,9 @@ do_sub(exarg_T *eap)
int do_again; /* do it again after joining lines */
int skip_match = FALSE;
linenr_T sub_firstlnum; /* nr of first sub line */
+#ifdef FEAT_TEXT_PROP
+ int save_for_undo = TRUE;
+#endif
/*
* The new text is build up step by step, to avoid too much
@@ -5603,9 +5606,14 @@ do_sub(exarg_T *eap)
p1 = sub_firstline;
#ifdef FEAT_TEXT_PROP
if (curbuf->b_has_textprop)
- adjust_prop_columns(lnum, regmatch.startpos[0].col,
+ {
+ // When text properties are changed, need to save for
+ // undo first, unless done already.
+ if (adjust_prop_columns(lnum, regmatch.startpos[0].col,
sublen - 1 - (regmatch.endpos[0].col
- - regmatch.startpos[0].col));
+ - regmatch.startpos[0].col), save_for_undo))
+ save_for_undo = FALSE;
+ }
#endif
}
else