about summary refs log tree commit diff
path: root/Src
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 /Src
parentf48457a695eef49fc3fb5571f73cc045bc7323cf (diff)
downloadzsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.tar.gz
zsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.tar.xz
zsh-89aca2d0a0f1b9a28149b6c1640a7e73feef5b39.zip
34752: another fix for history expansion in cmd subst
Diffstat (limited to 'Src')
-rw-r--r--Src/input.c16
1 files changed, 14 insertions, 2 deletions
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))