diff options
author | Peter Stephenson <pws@zsh.org> | 2015-01-06 17:05:17 +0000 |
---|---|---|
committer | Peter Stephenson <pws@zsh.org> | 2015-01-08 12:24:00 +0000 |
commit | c0d01a6fe0c67911650730cf13a2b9a0db16e59b (patch) | |
tree | 617d685ec8fabe09e1b83874d961436b86b16259 /Src/input.c | |
parent | 93846edb0d5d606e167f929532608eaea273c23f (diff) | |
download | zsh-c0d01a6fe0c67911650730cf13a2b9a0db16e59b.tar.gz zsh-c0d01a6fe0c67911650730cf13a2b9a0db16e59b.tar.xz zsh-c0d01a6fe0c67911650730cf13a2b9a0db16e59b.zip |
Fix command substitutions to parse contents as they are read in.
Do this by refactoring misnamed lexsave()/lexrestore() to allow continuity of history and input. Add test.
Diffstat (limited to 'Src/input.c')
-rw-r--r-- | Src/input.c | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Src/input.c b/Src/input.c index 9552331a9..04dda5acd 100644 --- a/Src/input.c +++ b/Src/input.c @@ -179,12 +179,12 @@ shingetline(void) /* Get the next character from the input. * Will call inputline() to get a new line where necessary. */ - + /**/ int ingetc(void) { - int lastc; + int lastc = ' '; if (lexstop) return ' '; @@ -196,7 +196,7 @@ ingetc(void) continue; if (((inbufflags & INP_LINENO) || !strin) && lastc == '\n') lineno++; - return lastc; + break; } /* @@ -208,7 +208,7 @@ ingetc(void) */ if (!inbufct && (strin || errflag)) { lexstop = 1; - return ' '; + break; } /* If the next element down the input stack is a continuation of * this, use it. @@ -219,8 +219,10 @@ ingetc(void) } /* As a last resort, get some more input */ if (inputline()) - return ' '; + break; } + zshlex_raw_add(lastc); + return lastc; } /* Read a line from the current command stream and store it as input */ @@ -426,6 +428,7 @@ inungetc(int c) inbufleft = 0; inbuf = inbufptr = ""; } + zshlex_raw_back(); } } |