]> granicus.if.org Git - vim/commitdiff
updated for version 7.3.1303 v7.3.1303
authorBram Moolenaar <Bram@vim.org>
Thu, 4 Jul 2013 18:25:41 +0000 (20:25 +0200)
committerBram Moolenaar <Bram@vim.org>
Thu, 4 Jul 2013 18:25:41 +0000 (20:25 +0200)
Problem:    Undo is synced whenever CTRL-R = is called, breaking some plugins.
Solution:   Only break undo when calling setline() or append().

src/edit.c
src/eval.c
src/globals.h
src/testdir/test61.in
src/testdir/test61.ok
src/version.c

index ee308bd79966912f0ff5486e66052d0a663dcad2..b76ebe5c10e9a4159deaf858123f4d657af109e2 100644 (file)
@@ -8135,9 +8135,9 @@ ins_reg()
 # ifdef USE_IM_CONTROL
        int     im_on = im_get_status();
 # endif
-       /* Sync undo, so the effect of e.g., setline() can be undone. */
-       u_sync(TRUE);
-       ins_need_undo = TRUE;
+       /* Sync undo when evaluating the expression calls setline() or
+        * append(), so that it can be undone separately. */
+       u_sync_once = 2;
 
        regname = get_expr_register();
 # ifdef USE_IM_CONTROL
@@ -8178,6 +8178,9 @@ ins_reg()
 #ifdef FEAT_EVAL
     }
     --no_u_sync;
+    if (u_sync_once == 1)
+       ins_need_undo = TRUE;
+    u_sync_once = 0;
 #endif
 #ifdef FEAT_CMDL_INFO
     clear_showcmd();
index 5cac7b4adf0d3dd7d2b7086dd9d1d967dc20a228..2a2817e6d23cd15751b88e46e9c5c1f736e5b048 100644 (file)
@@ -8742,6 +8742,14 @@ f_append(argvars, rettv)
     typval_T   *tv;
     long       added = 0;
 
+    /* When coming here from Insert mode, sync undo, so that this can be
+     * undone separately from what was previously inserted. */
+    if (u_sync_once == 2)
+    {
+       u_sync_once = 1; /* notify that u_sync() was called */
+       u_sync(TRUE);
+    }
+
     lnum = get_tv_lnum(argvars);
     if (lnum >= 0
            && lnum <= curbuf->b_ml.ml_line_count
@@ -16408,6 +16416,15 @@ f_setline(argvars, rettv)
        rettv->vval.v_number = 1;       /* FAIL */
        if (line == NULL || lnum < 1 || lnum > curbuf->b_ml.ml_line_count + 1)
            break;
+
+       /* When coming here from Insert mode, sync undo, so that this can be
+        * undone separately from what was previously inserted. */
+       if (u_sync_once == 2)
+       {
+           u_sync_once = 1; /* notify that u_sync() was called */
+           u_sync(TRUE);
+       }
+
        if (lnum <= curbuf->b_ml.ml_line_count)
        {
            /* existing line, replace it */
index 1e966cfec3355713bf617af36817ff1926bf537e..feb1dd457788e719fbe5347d6ae95c4474108fc3 100644 (file)
@@ -916,6 +916,10 @@ EXTERN int no_zero_mapping INIT(= 0);      /* mapping zero not allowed */
 EXTERN int allow_keys INIT(= FALSE);   /* allow key codes when no_mapping
                                         * is set */
 EXTERN int no_u_sync INIT(= 0);                /* Don't call u_sync() */
+#ifdef FEAT_EVAL
+EXTERN int u_sync_once INIT(= 0);      /* Call u_sync() once when evaluating
+                                          an expression. */
+#endif
 
 EXTERN int restart_edit INIT(= 0);     /* call edit when next cmd finished */
 EXTERN int arrow_used;                 /* Normally FALSE, set to TRUE after
index 422adb897cf1c5ae4ed8648bdae71d0063ce396a..dc24ab980443fd13140f03f5f6269c04d0f4e932 100644 (file)
@@ -93,7 +93,17 @@ ob\e
 :set ul=100
 o1\ea2\12=setline('.','1234')
 
-\euu:%w >>test.out
+\euu:"
+oc\e
+:set ul=100
+o1\ea2\12=setline('.','1234')
+
+\eu:"
+od\e
+:set ul=100
+o1\ea2\12=string(123)
+\eu:"
+:%w >>test.out
 :qa!
 ENDTEST
 
index 0e3a52508842b2e35fd5ab33f8c46bdf3db32c59..ea4b473ad76b049114da47fc097c0bed49d66135 100644 (file)
@@ -44,3 +44,6 @@ three
 
 a
 b
+c
+12
+d
index e84ea523029898a9c209caec83d7955eb9b734ba..7b6b20d3db60316fb8a7b03c54b9096e282708ef 100644 (file)
@@ -728,6 +728,8 @@ static char *(features[]) =
 
 static int included_patches[] =
 {   /* Add new patch number below this line */
+/**/
+    1303,
 /**/
     1302,
 /**/