mirror of
git://git.code.sf.net/p/zsh/code
synced 2024-09-28 15:01:21 +02:00
34319: fix alias expansion in history for command substitution
This commit is contained in:
parent
870d880bef
commit
e34ce85151
@ -1,3 +1,8 @@
|
||||
2015-01-18 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||
|
||||
* 34319: Src/hist.c, Src/lex.c: alias expansion in history of
|
||||
command substitution.
|
||||
|
||||
2015-01-17 Axel Beckert <abe@deuxchevaux.org>
|
||||
|
||||
* 34314: Wieland Hoffmann: Completion/Unix/Command/_git: Change
|
||||
|
26
Src/hist.c
26
Src/hist.c
@ -329,7 +329,16 @@ static void
|
||||
ihwaddc(int c)
|
||||
{
|
||||
/* Only if history line exists and lexing has not finished. */
|
||||
if (chline && !(errflag || lexstop)) {
|
||||
if (chline && !(errflag || lexstop) &&
|
||||
/*
|
||||
* If we're reading inside a word for command substitution
|
||||
* we allow the lexer to expand aliases but don't deal
|
||||
* with them here. Note matching code in ihungetc().
|
||||
* TBD: it might be neater to deal with all aliases in this
|
||||
* fashion as we never need the expansion in the history
|
||||
* line, only in the lexer and above.
|
||||
*/
|
||||
!((histactive & HA_INWORD) && (inbufflags & INP_ALIAS))) {
|
||||
/* Quote un-expanded bangs in the history line. */
|
||||
if (c == bangchar && stophist < 2 && qbang)
|
||||
/* If qbang is not set, we do not escape this bangchar as it's *
|
||||
@ -892,11 +901,16 @@ ihungetc(int c)
|
||||
zlemetall--;
|
||||
exlast++;
|
||||
}
|
||||
DPUTS(hptr <= chline, "BUG: hungetc attempted at buffer start");
|
||||
hptr--;
|
||||
DPUTS(*hptr != (char) c, "BUG: wrong character in hungetc() ");
|
||||
qbang = (c == bangchar && stophist < 2 &&
|
||||
hptr > chline && hptr[-1] == '\\');
|
||||
if (!(histactive & HA_INWORD) || !(inbufflags & INP_ALIAS)) {
|
||||
DPUTS(hptr <= chline, "BUG: hungetc attempted at buffer start");
|
||||
hptr--;
|
||||
DPUTS(*hptr != (char) c, "BUG: wrong character in hungetc() ");
|
||||
qbang = (c == bangchar && stophist < 2 &&
|
||||
hptr > chline && hptr[-1] == '\\');
|
||||
} else {
|
||||
/* No active bangs in aliases */
|
||||
qbang = 0;
|
||||
}
|
||||
if (doit)
|
||||
inungetc(c);
|
||||
if (!qbang)
|
||||
|
@ -1674,7 +1674,7 @@ parse_subst_string(char *s)
|
||||
/* Called below to report word positions. */
|
||||
|
||||
/**/
|
||||
mod_export void
|
||||
static void
|
||||
gotword(void)
|
||||
{
|
||||
we = zlemetall + 1 - inbufct + (addedx == 2 ? 1 : 0);
|
||||
|
Loading…
Reference in New Issue
Block a user