summaryrefslogtreecommitdiff
path: root/Src/hist.c
diff options
context:
space:
mode:
authorPeter Stephenson <p.w.stephenson@ntlworld.com>2018-04-04 18:33:00 +0100
committerPeter Stephenson <p.w.stephenson@ntlworld.com>2018-04-04 18:33:00 +0100
commit3517e4a9a5caf2c3385a0b223a0474724c703d96 (patch)
treed75e40e0bdcbd9baa10b858703a1c8ea47ed2385 /Src/hist.c
parent1bd2ecc17d74b6a8ffba97806cf90ef706d7411b (diff)
downloadzsh-3517e4a9a5caf2c3385a0b223a0474724c703d96.tar.gz
zsh-3517e4a9a5caf2c3385a0b223a0474724c703d96.zip
42581(?): Fix ZLE inline history expansion.
Seen with magic-space. If there's a parse error in command subtitution we need to complete reading history to ensure the command line buffer is finished.
Diffstat (limited to 'Src/hist.c')
-rw-r--r--Src/hist.c22
1 files changed, 20 insertions, 2 deletions
diff --git a/Src/hist.c b/Src/hist.c
index b798be8e4..dbdc1e4e5 100644
--- a/Src/hist.c
+++ b/Src/hist.c
@@ -465,8 +465,26 @@ herrflush(void)
{
inpopalias();
- while (!lexstop && inbufct && !strin)
- hwaddc(ingetc());
+ if (lexstop)
+ return;
+ /*
+ * The lex_add_raw test is needed if we are parsing a command
+ * substitution when expanding history for ZLE: strin is set but we
+ * need to finish off the input because the string we are reading is
+ * going to be used directly in the line that goes to ZLE.
+ *
+ * Note that this is a side effect --- this is not the usual reason
+ * for testing lex_add_raw which is to add the text to a different
+ * buffer used when we are actually parsing the command substituion
+ * (nothing to do with ZLE). Sorry.
+ */
+ while (inbufct && (!strin || lex_add_raw)) {
+ int c = ingetc();
+ if (!lexstop) {
+ hwaddc(c);
+ addtoline(c);
+ }
+ }
}
/*