summary refs log tree commit diff
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2016-06-02 12:48:10 +0200
committerOliver Kiddle <opk@zsh.org>2016-06-02 12:48:10 +0200
commit3fdf1f16e34d22ebdb40bd411467f7b977ec8bb6 (patch)
treed8ca2020aadf115c206cbaf28cc862874a1bb60b
parent8cf68f05ab1b13f147521ad64df34dae256e09fb (diff)
downloadzsh-3fdf1f16e34d22ebdb40bd411467f7b977ec8bb6.tar.gz
zsh-3fdf1f16e34d22ebdb40bd411467f7b977ec8bb6.tar.xz
zsh-3fdf1f16e34d22ebdb40bd411467f7b977ec8bb6.zip
38540: fix undo problem by not moving the current change when only undoing a history line change
-rw-r--r--ChangeLog5
-rw-r--r--Src/Zle/zle_utils.c11
2 files changed, 13 insertions, 3 deletions
diff --git a/ChangeLog b/ChangeLog
index 9f1220d49..59a2375d1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2016-06-02  Oliver Kiddle  <opk@zsh.org>
+
+	* 38540: Src/Zle/zle_utils.c: fix undo problem by not moving
+	the current change when only undoing a history line change
+
 2016-06-02  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* users/21603: Src/utils.c: Don't do second attempt at read/poll
diff --git a/Src/Zle/zle_utils.c b/Src/Zle/zle_utils.c
index 68794c66a..80219a441 100644
--- a/Src/Zle/zle_utils.c
+++ b/Src/Zle/zle_utils.c
@@ -1589,9 +1589,14 @@ undo(char **args)
 	    break;
 	if (prev->changeno <= undo_limitno && !*args)
 	    return 1;
-	if (!unapplychange(prev) && last_change >= 0)
-	    unapplychange(prev);
-	curchange = prev;
+	if (!unapplychange(prev)) {
+	    if (last_change >= 0) {
+		unapplychange(prev);
+		curchange = prev;
+	    }
+	} else {
+	    curchange = prev;
+	}
     } while (last_change >= (zlong)0 || (curchange->flags & CH_PREV));
     setlastline();
     return 0;