about summary refs log tree commit diff
path: root/Src
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-06-03 22:06:59 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-06-03 22:06:59 +0000
commitd292edc4dc4b35438dbbf0906a568d5eedfa1761 (patch)
tree3c908c18464a073c398493e5b48a06ae68e006a7 /Src
parent22af58bf2b5b695cdbfaf4b7cdf82bb09136860b (diff)
downloadzsh-d292edc4dc4b35438dbbf0906a568d5eedfa1761.tar.gz
zsh-d292edc4dc4b35438dbbf0906a568d5eedfa1761.tar.xz
zsh-d292edc4dc4b35438dbbf0906a568d5eedfa1761.zip
29452: allow completion of parameter flags
Diffstat (limited to 'Src')
-rw-r--r--Src/Zle/compcore.c16
1 files changed, 13 insertions, 3 deletions
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 5514e2e1d..704e125bc 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1150,7 +1150,7 @@ check_param(char *s, int set, int test)
 	p[1] != Inpar && p[1] != Inbrack && p[1] != Snull) {
 	/* This is a parameter expression, not $(...), $[...], $'...'. */
 	char *b = p + 1, *e = b, *ie;
-	int n = 0, br = 1, nest = 0;
+	int br = 1, nest = 0;
 
 	if (*b == Inbrace) {
 	    char *tb = b;
@@ -1161,7 +1161,17 @@ check_param(char *s, int set, int test)
 
 	    /* Ignore the possible (...) flags. */
 	    b++, br++;
-	    n = skipparens(Inpar, Outpar, &b);
+	    if (skipparens(Inpar, Outpar, &b) > 0) {
+		/*
+		 * We are still within the parameter flags.  There's no
+		 * point trying to do anything clever here with
+		 * parameter names.  Instead, just report that we are in
+		 * a brace parameter but let the completion function
+		 * decide what to do about it.
+		 */
+		ispar = 2;
+		return NULL;
+	    }
 
 	    for (tb = p - 1; tb > s && *tb != Outbrace && *tb != Inbrace; tb--);
 	    if (tb > s && *tb == Inbrace && (tb[-1] == String || *tb == Qstring))
@@ -1204,7 +1214,7 @@ check_param(char *s, int set, int test)
 	}
 
 	/* Now make sure that the cursor is inside the name. */
-	if (offs <= e - s && offs >= b - s && n <= 0) {
+	if (offs <= e - s && offs >= b - s) {
 	    char sav;
 
 	    if (br) {