about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@zsh.org>2015-03-20 11:02:23 +0000
committerPeter Stephenson <pws@zsh.org>2015-03-20 11:02:23 +0000
commit89aca2d0a0f1b9a28149b6c1640a7e73feef5b39 (patch)
tree9693b144c879e2eed8c010f03c131f7f07f4b7cc
parentf48457a695eef49fc3fb5571f73cc045bc7323cf (diff)
downloadzsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.tar.gz
zsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.tar.xz
zsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.zip
34752: another fix for history expansion in cmd subst
-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))