about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-08-31 13:57:37 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-08-31 13:57:37 +0000
commitbf0452b632d1b051de773143a0f9a3c0a84a61e0 (patch)
treee41948b0537dc77671dc07dfb2e62b89503dd009 /Src
parentced33358fcbeb9e469927a63c33d73acc1db5c32 (diff)
downloadzsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.tar.gz
zsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.tar.xz
zsh-bf0452b632d1b051de773143a0f9a3c0a84a61e0.zip
zsh-workers/7574
Diffstat (limited to 'Src')
-rw-r--r--Src/subst.c11
1 files changed, 9 insertions, 2 deletions
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) {