changeset 4909:2945fe016b93 v7.3.1200

updated for version 7.3.1200 Problem: When calling setline() from Insert mode, using CTRL-R =, undo does not work properly. (Israel Chauca) Solution: Sync undo after evaluating the expression. (Christian Brabandt)
author Bram Moolenaar <bram@vim.org>
date Sat, 15 Jun 2013 17:54:43 +0200
parents e362e9e2ae39
children e0ff44b689e3
files src/edit.c src/testdir/test61.in src/testdir/test61.ok src/version.c
diffstat 4 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/src/edit.c
+++ b/src/edit.c
@@ -8126,10 +8126,8 @@ ins_reg()
     --no_mapping;
 
 #ifdef FEAT_EVAL
-    /*
-     * Don't call u_sync() while getting the expression,
-     * evaluating it or giving an error message for it!
-     */
+    /* Don't call u_sync() while typing the expression or giving an error
+     * message for it. Only call it explicitly. */
     ++no_u_sync;
     if (regname == '=')
     {
@@ -8142,6 +8140,9 @@ ins_reg()
 	if (im_on)
 	    im_set_active(TRUE);
 # endif
+	if (regname == '=')
+	    /* sync undo, so the effect of e.g., setline() can be undone */
+	    u_sync(TRUE);
     }
     if (regname == NUL || !valid_yank_reg(regname, FALSE))
     {
--- a/src/testdir/test61.in
+++ b/src/testdir/test61.in
@@ -84,6 +84,16 @@ ggO---:0put c
 ggO---:0put b
 ggO---:0put a
 ggO---:w >>test.out
+:so small.vim
+:set nocp
+:enew!
+oa
+:set ul=100
+ob
+:set ul=100
+o1a2=setline('.','1234')
+
+uu:%w >>test.out
 :qa!
 ENDTEST
 
--- a/src/testdir/test61.ok
+++ b/src/testdir/test61.ok
@@ -41,3 +41,6 @@ one one one
 two
 two
 three
+
+a
+b
--- a/src/version.c
+++ b/src/version.c
@@ -729,6 +729,8 @@ static char *(features[]) =
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    1200,
+/**/
     1199,
 /**/
     1198,