summary refs log tree commit diff
diff options
context:
space:
mode:
-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;