From 61a5c826c8472a8d9058ebb93e5fbbc5796cd46d Mon Sep 17 00:00:00 2001 From: Peter Stephenson Date: Tue, 23 Jan 2007 16:07:46 +0000 Subject: 23126, modified: bug in zle history inside $( and $(( --- Src/lex.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) (limited to 'Src/lex.c') diff --git a/Src/lex.c b/Src/lex.c index 095d58150..7748bedad 100644 --- a/Src/lex.c +++ b/Src/lex.c @@ -542,14 +542,14 @@ cmd_or_math(int cs_type) c = dquote_parse(')', 0); cmdpop(); *bptr = '\0'; - if (!c) { - c = hgetc(); - if (c == ')') - return 1; - hungetc(c); - lexstop = 0; - c = ')'; - } + if (c) + return 1; + c = hgetc(); + if (c == ')') + return 1; + hungetc(c); + lexstop = 0; + c = ')'; hungetc(c); lexstop = 0; while (len > oldlen) { @@ -1436,8 +1436,15 @@ dquote_parse(char endchar, int sub) cmdpop(); if (lexstop) err = intick || endchar || err; - else if (err == 1) + else if (err == 1) { + /* + * TODO: as far as I can see, this hack is used in gettokstr() + * to hungetc() a character on an error. However, I don't + * understand what that actually gets us, and we can't guarantee + * it's a character anyway, because of the previous test. + */ err = c; + } if (zlemath && zlemetacs <= zlemetall + 1 - inbufct) inwhat = IN_MATH; return err; -- cgit 1.4.1