about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-20 08:36:55 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-20 08:36:55 +0000
commitbb8944835c4f55c5ce143731eb9dab08619be5e9 (patch)
tree516447c98e1587eb2f6d0b7f389442f4a2d72864
parent6cc7e4a7f6ef2ba514a1c8cafc476f9ffc80548a (diff)
downloadzsh-bb8944835c4f55c5ce143731eb9dab08619be5e9.tar.gz
zsh-bb8944835c4f55c5ce143731eb9dab08619be5e9.tar.xz
zsh-bb8944835c4f55c5ce143731eb9dab08619be5e9.zip
zsh-workers/9381
-rw-r--r--Src/Zle/compresult.c35
1 files changed, 28 insertions, 7 deletions
diff --git a/Src/Zle/compresult.c b/Src/Zle/compresult.c
index 4a8a7af49..6794e45d3 100644
--- a/Src/Zle/compresult.c
+++ b/Src/Zle/compresult.c
@@ -785,19 +785,40 @@ do_single(Cmatch m)
 	    else {
 		/* Build the path name. */
 		if (partest && !*psuf && !(m->flags & CMF_PARNEST)) {
-		    int ne = noerrs;
+		    int ne = noerrs, tryit = 1;
 
 		    p = (char *) zhalloc(strlen((m->flags & CMF_ISPAR) ?
 						parpre : m->ripre) +
 					 strlen(str) + 2);
 		    sprintf(p, "%s%s%c",
 			    ((m->flags & CMF_ISPAR) ? parpre : m->ripre), str,
-			    ((m->flags & CMF_PARBR) ? Outbrace : '\0'));
-		    noerrs = 1;
-		    parsestr(p);
-		    singsub(&p);
-		    errflag = 0;
-		    noerrs = ne;
+			    ((m->flags & CMF_PARBR) ? '}' : '\0'));
+		    if (*p == '$') {
+			char *n;
+			Param pm;
+
+			if (p[1] == '{') {
+			    char *e;
+
+			    n = dupstring(p + 2);
+			    e = n + strlen(n) - 1;
+
+			    if (*e == '}')
+				*e = '\0';
+			} else
+			    n = p + 1;
+
+			if ((pm = (Param) paramtab->getnode(paramtab, n)) &&
+			    PM_TYPE(pm->flags) != PM_SCALAR)
+			    tryit = 0;
+		    }
+		    if (tryit) {
+			noerrs = 1;
+			parsestr(p);
+			singsub(&p);
+			errflag = 0;
+			noerrs = ne;
+		    }
 		} else {
 		    p = (char *) zhalloc(strlen(prpre) + strlen(str) +
 				 strlen(psuf) + 3);