about summary refs log tree commit diff
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2011-06-04 21:32:06 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2011-06-04 21:32:06 +0000
commitd7582f006f950be2622bc0d5ff26aaaa20af3b7f (patch)
treeae95a74541d09eb28cd6a13907a73dfc829c56cb
parentd292edc4dc4b35438dbbf0906a568d5eedfa1761 (diff)
downloadzsh-d7582f006f950be2622bc0d5ff26aaaa20af3b7f.tar.gz
zsh-d7582f006f950be2622bc0d5ff26aaaa20af3b7f.tar.xz
zsh-d7582f006f950be2622bc0d5ff26aaaa20af3b7f.zip
29459: Further fixes for parameter flag completion,
plus drive-by fix for double-quoted parameter completion with flags
-rw-r--r--ChangeLog9
-rw-r--r--Completion/Zsh/Context/_brace_parameter2
-rw-r--r--Src/Zle/compcore.c6
3 files changed, 13 insertions, 4 deletions
diff --git a/ChangeLog b/ChangeLog
index 9e6efc78e..d2dab008a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2011-06-04  Peter Stephenson  <p.w.stephenson@ntlworld.com>
+
+	* Completion/Zsh/Context/_brace_parameter, Src/Zle/compcore.c
+	(check_param): In shell function, check for ${( not at start
+	of match; in C code, check for untokenized parentheses when
+	in double quotes.
+
 2011-06-03  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* 29452: Completion/Zsh/Context/_brace_parameter,
@@ -14951,5 +14958,5 @@
 
 *****************************************************
 * This is used by the shell to define $ZSH_PATCHLEVEL
-* $Revision: 1.5361 $
+* $Revision: 1.5362 $
 *****************************************************
diff --git a/Completion/Zsh/Context/_brace_parameter b/Completion/Zsh/Context/_brace_parameter
index e6a2c4c80..c0ecf251b 100644
--- a/Completion/Zsh/Context/_brace_parameter
+++ b/Completion/Zsh/Context/_brace_parameter
@@ -4,7 +4,7 @@ local char delim found_percent found_m exp
 local -a flags
 integer q_last n_q
 
-if [[ $PREFIX = '${('[^\)]# ]]; then
+if [[ $PREFIX = *'${('[^\)]# ]]; then
   # Parameter flags.
   compset -p 3
 
diff --git a/Src/Zle/compcore.c b/Src/Zle/compcore.c
index 704e125bc..0a1a97c3d 100644
--- a/Src/Zle/compcore.c
+++ b/Src/Zle/compcore.c
@@ -1099,7 +1099,7 @@ mod_export char *
 check_param(char *s, int set, int test)
 {
     char *p;
-    int found = 0;
+    int found = 0, qstring = 0;
 
     zsfree(parpre);
     parpre = NULL;
@@ -1126,6 +1126,7 @@ check_param(char *s, int set, int test)
 		!(*p == String && p[1] == Snull) &&
 		!(*p == Qstring && p[1] == '\'')) {
 		found = 1;
+		qstring = (*p == Qstring);
 		break;
 	    }
 	}
@@ -1161,7 +1162,8 @@ check_param(char *s, int set, int test)
 
 	    /* Ignore the possible (...) flags. */
 	    b++, br++;
-	    if (skipparens(Inpar, Outpar, &b) > 0) {
+	    if ((qstring ? skipparens('(', ')', &b) :
+		 skipparens(Inpar, Outpar, &b)) > 0) {
 		/*
 		 * We are still within the parameter flags.  There's no
 		 * point trying to do anything clever here with