diff options
author | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-31 13:57:37 +0000 |
---|---|---|
committer | Tanaka Akira <akr@users.sourceforge.net> | 1999-08-31 13:57:37 +0000 |
commit | bf0452b632d1b051de773143a0f9a3c0a84a61e0 (patch) | |
tree | e41948b0537dc77671dc07dfb2e62b89503dd009 | |
parent | ced33358fcbeb9e469927a63c33d73acc1db5c32 (diff) | |
download | zsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.tar.gz zsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.tar.xz zsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.zip |
zsh-workers/7574
-rw-r--r-- | Doc/Zsh/expn.yo | 5 | ||||
-rw-r--r-- | Src/subst.c | 11 |
2 files changed, 13 insertions, 3 deletions
diff --git a/Doc/Zsh/expn.yo b/Doc/Zsh/expn.yo index 3a56bb7ac..429429941 100644 --- a/Doc/Zsh/expn.yo +++ b/Doc/Zsh/expn.yo @@ -604,7 +604,10 @@ Remove one level of quotes from the resulting words. ) item(tt(%))( Expand all tt(%) escapes in the resulting words in the same way as in -prompts (see noderef(Prompt Expansion)). +prompts (see noderef(Prompt Expansion)). If this flag is given twice, +full prompt expansion is done on the resulting words, depending on the +setting of the tt(PROMPT_SUBST) and tt(PROMPT_BANG) options. The +tt(PROMPT_PERCENT) option is temporarily turned on in any case. ) item(tt(X))( With this flag parsing errors occuring with the tt(Q) flag or the diff --git a/Src/subst.c b/Src/subst.c index a3853472c..70e5c1755 100644 --- a/Src/subst.c +++ b/Src/subst.c @@ -938,7 +938,7 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) break; case '%': - presc = 1; + presc++; break; default: @@ -1659,8 +1659,12 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) } } if (presc) { - int len; + int ops = opts[PROMPTSUBST], opb = opts[PROMPTBANG]; + int opp = opts[PROMPTPERCENT], len; + opts[PROMPTPERCENT] = 1; + if (presc < 2) + opts[PROMPTSUBST] = opts[PROMPTBANG] = 0; if (isarr) { char **ap; @@ -1679,6 +1683,9 @@ paramsubst(LinkList l, LinkNode n, char **str, int qt, int ssub) val = unmetafy(promptexpand(metafy(val, len, META_NOALLOC), 0, NULL, NULL), &len); } + opts[PROMPTSUBST] = ops; + opts[PROMPTBANG] = opb; + opts[PROMPTPERCENT] = opp; } if (quotemod) { if (isarr) { |