summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2014-11-05 22:50:48 +0100
committerOliver Kiddle <opk@zsh.org>2014-11-05 22:50:48 +0100
commitc7ff843ecf60ab74ce98929e45029b1aef5014e1 (patch)
treea8fdeed6b399dd36c055e7030ccad10df1b1528a /Src
parent4b66ec003ff0631e39240576920dda971d555f6d (diff)
downloadzsh-c7ff843ecf60ab74ce98929e45029b1aef5014e1.tar.gz
zsh-c7ff843ecf60ab74ce98929e45029b1aef5014e1.tar.xz
zsh-c7ff843ecf60ab74ce98929e45029b1aef5014e1.zip
33604: fix change merging for vi mode where a change has just been undone
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/zle_utils.c6
-rw-r--r--Src/Zle/zle_vi.c4
2 files changed, 5 insertions, 5 deletions
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 741f119d2..e95a34b95 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1395,7 +1395,8 @@ static struct change *nextchanges, *endnextchanges;
 
 /* incremented to provide a unique change number */
 
-static zlong undo_changeno;
+/**/
+zlong undo_changeno;
 
 /* If non-zero, the last increment to undo_changeno was for the variable */
 
@@ -1668,8 +1669,7 @@ splitundo(char **args)
 {
     if (vistartchange >= 0) {
 	mergeundo();
-	vistartchange = (curchange && curchange->prev) ?
-	    curchange->prev->changeno : 0;
+	vistartchange = undo_changeno;
     }
     handleundo();
     return 0;
diff --git a/Src/Zle/zle_vi.c b/Src/Zle/zle_vi.c
index 18c76f917..d74b40d62 100644
--- a/Src/Zle/zle_vi.c
+++ b/Src/Zle/zle_vi.c
@@ -109,7 +109,7 @@ startvitext(int im)
 {
     startvichange(im);
     selectkeymap("main", 1);
-    vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
+    vistartchange = undo_changeno;
     viinsbegin = zlecs;
 }
 
@@ -403,7 +403,7 @@ vichange(UNUSED(char **args))
 	forekill(c2 - zlecs, CUT_RAW);
 	selectkeymap("main", 1);
 	viinsbegin = zlecs;
-	vistartchange = (curchange && curchange->prev) ? curchange->prev->changeno : 0;
+	vistartchange = undo_changeno;
     }
     return ret;
 }