From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 23194 invoked by alias); 4 Jun 2011 21:23:33 -0000 Mailing-List: contact zsh-workers-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Workers List List-Post: List-Help: X-Seq: 29459 Received: (qmail 29681 invoked from network); 4 Jun 2011 21:23:13 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received-SPF: pass (ns1.primenet.com.au: SPF record at ntlworld.com designates 81.103.221.48 as permitted sender) Date: Sat, 4 Jun 2011 22:22:57 +0100 From: Peter Stephenson To: "Zsh Hackers' List" Subject: Re: PATCH: completion for parameter flags Message-ID: <20110604222257.0d60cccd@pws-pc.ntlworld.com> In-Reply-To: References: <20110603215453.1260c7f0@pws-pc.ntlworld.com> X-Mailer: Claws Mail 3.7.9 (GTK+ 2.22.0; x86_64-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Cloudmark-Analysis: v=1.1 cv=JvdXmxIgLJv2/GthKqHpGJEEHukvLcvELVXUanXFreg= c=1 sm=0 a=np55Vf1oFRoA:10 a=uObrxnre4hsA:10 a=kj9zAlcOel0A:10 a=pGLkceISAAAA:8 a=NLZqzBF-AAAA:8 a=12H9U2fOW-WAWUaWG7cA:9 a=tc75CfBKCBFQzG0JQJMA:7 a=CjuIK1q_8ugA:10 a=MSl-tDqOz04A:10 a=_dQi-Dcv4p4A:10 a=HpAAvcLHHh0Zw7uRqdWCyQ==:117 On Sat, 4 Jun 2011 14:39:52 +0200 Mikael Magnusson wrote: > ${( shows me glob qualifiers. > foo${( does nothing at all. This exposed an existing bug, that "${(stuff) wasn't handled properly. In a quoted string it needs to scan for untokenized parentheses. Index: Completion/Zsh/Context/_brace_parameter =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_brace_parameter,v retrieving revision 1.2 diff -p -u -r1.2 _brace_parameter --- Completion/Zsh/Context/_brace_parameter 3 Jun 2011 22:06:59 -0000 1.2 +++ Completion/Zsh/Context/_brace_parameter 4 Jun 2011 21:19:17 -0000 @@ -4,7 +4,7 @@ local char delim found_percent found_m e local -a flags integer q_last n_q -if [[ $PREFIX = '${('[^\)]# ]]; then +if [[ $PREFIX = *'${('[^\)]# ]]; then # Parameter flags. compset -p 3 Index: Src/Zle/compcore.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/compcore.c,v retrieving revision 1.108 diff -p -u -r1.108 compcore.c --- Src/Zle/compcore.c 3 Jun 2011 22:07:00 -0000 1.108 +++ Src/Zle/compcore.c 4 Jun 2011 21:19:17 -0000 @@ -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 -- Peter Stephenson Web page now at http://homepage.ntlworld.com/p.w.stephenson/