about summary refs log tree commit diff
path: root/Src/Zle/zle_main.c
diff options
context:
space:
mode:
authorOliver Kiddle <okiddle@yahoo.co.uk>2014-01-31 14:01:12 +0100
committerOliver Kiddle <okiddle@yahoo.co.uk>2014-01-31 14:03:47 +0100
commita8c4ed64ee684227c0dd3142e912f7faca8bd1fb (patch)
treedc5796a80d8476315a908c2556d5c6cd43fcba0b /Src/Zle/zle_main.c
parent779ad93490f03e0759c065618a3267d2e6f07b84 (diff)
downloadzsh-a8c4ed64ee684227c0dd3142e912f7faca8bd1fb.tar.gz
zsh-a8c4ed64ee684227c0dd3142e912f7faca8bd1fb.tar.xz
zsh-a8c4ed64ee684227c0dd3142e912f7faca8bd1fb.zip
32314: merge undo events corresponding to vi change in the vi-cmd-mode widget so undo from insert mode is useful again
Diffstat (limited to 'Src/Zle/zle_main.c')
-rw-r--r--Src/Zle/zle_main.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c
index a2b20df25..f5aec8403 100644
--- a/Src/Zle/zle_main.c
+++ b/Src/Zle/zle_main.c
@@ -157,10 +157,10 @@ mod_export char *statusline;
 /**/
 int stackhist, stackcs;
 
-/* != 0 if we are making undo records */
+/* position in undo stack from when the current vi change started */
 
 /**/
-int undoing;
+zlong vistartchange;
 
 /* current modifier status */
 
@@ -1080,8 +1080,7 @@ zlecore(void)
 	    if (invicmdmode() && zlecs > findbol() &&
 		(zlecs == zlell || zleline[zlecs] == ZWC('\n')))
 		DECCS();
-	    if (undoing)
-		handleundo();
+	    handleundo();
 	} else {
 	    errflag = 1;
 	    break;
@@ -1190,7 +1189,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
     zlereadflags = flags;
     zlecontext = context;
     histline = curhist;
-    undoing = 1;
+    vistartchange = 0;
     zleline = (ZLE_STRING_T)zalloc(((linesz = 256) + 2) * ZLE_CHAR_SIZE);
     *zleline = ZWC('\0');
     virangeflag = lastcmd = done = zlecs = zlell = mark = 0;
@@ -1198,6 +1197,7 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
     viinsbegin = 0;
     statusline = NULL;
     selectkeymap("main", 1);
+    initundo();
     /*
      * If main is linked to the viins keymap, we need to register
      * explicitly that we're now in vi insert mode as there's
@@ -1222,7 +1222,6 @@ zleread(char **lp, char **rp, int flags, int context, char *init, char *finish)
 	    stackhist = -1;
 	}
     }
-    initundo();
     if (isset(PROMPTCR))
 	putc('\r', shout);
     if (tmout)