about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog6
-rw-r--r--Src/input.c16
2 files changed, 20 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 91709629a..1711a5087 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2015-03-20  Peter Stephenson  <p.stephenson@samsung.com>
+
+	* 34752: Src/input.c: history expansion in command substitution
+	*still* didn't work although the command put back into the
+	history was correct.
+
 2015-03-19  Peter Stephenson  <p.stephenson@samsung.com>
 
 	* 34742: Src/hist.c: history expansion in command substitution
diff --git a/Src/input.c b/Src/input.c
index 92b1ad1f7..30970a060 100644
--- a/Src/input.c
+++ b/Src/input.c
@@ -571,8 +571,20 @@ inpoptop(void)
 {
     if (!lexstop) {
 	inbufflags &= ~INP_ALCONT;
-	while (inbufptr > inbuf)
-	    inungetc(inbufptr[-1]);
+	while (inbufptr > inbuf) {
+	    inbufptr--;
+	    inbufct++;
+	    inbufleft++;
+	    /*
+	     * As elsewhere in input and history mechanisms:
+	     * unwinding aliases and unwinding history have different
+	     * implications as aliases are after the lexer while
+	     * history is before, but they're both pushed onto
+	     * the input stack.
+	     */
+	    if ((inbufflags & (INP_ALIAS|INP_HIST)) == INP_ALIAS)
+		zshlex_raw_back();
+	}
     }
 
     if (inbuf && (inbufflags & INP_FREE))