From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 29716 invoked from network); 9 Apr 2008 11:21:11 -0000 X-Spam-Checker-Version: SpamAssassin 3.2.4 (2008-01-01) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-2.3 required=5.0 tests=AWL,BAYES_00 autolearn=ham version=3.2.4 Received: from news.dotsrc.org (HELO a.mx.sunsite.dk) (130.225.247.88) by ns1.primenet.com.au with SMTP; 9 Apr 2008 11:21:11 -0000 Received-SPF: none (ns1.primenet.com.au: domain at sunsite.dk does not designate permitted sender hosts) Received: (qmail 93080 invoked from network); 9 Apr 2008 11:21:07 -0000 Received: from sunsite.dk (130.225.247.90) by a.mx.sunsite.dk with SMTP; 9 Apr 2008 11:21:07 -0000 Received: (qmail 5970 invoked by alias); 9 Apr 2008 11:21:04 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 24804 Received: (qmail 5955 invoked from network); 9 Apr 2008 11:21:04 -0000 Received: from bifrost.dotsrc.org (130.225.254.106) by sunsite.dk with SMTP; 9 Apr 2008 11:21:04 -0000 Received: from cluster-d.mailcontrol.com (cluster-d.mailcontrol.com [217.69.20.190]) by bifrost.dotsrc.org (Postfix) with ESMTP id CAD5B802A5F0 for ; Wed, 9 Apr 2008 13:21:00 +0200 (CEST) Received: from cameurexb01.EUROPE.ROOT.PRI ([62.189.241.200]) by rly32d.srv.mailcontrol.com (MailControl) with ESMTP id m39BKfuo027311 for ; Wed, 9 Apr 2008 12:20:55 +0100 Received: from news01 ([10.103.143.38]) by cameurexb01.EUROPE.ROOT.PRI with Microsoft SMTPSVC(6.0.3790.3959); Wed, 9 Apr 2008 12:20:53 +0100 Date: Wed, 9 Apr 2008 12:20:53 +0100 From: Peter Stephenson To: zsh-workers Subject: Re: _subscript quotes too much Message-ID: <20080409122053.3ddfdc42@news01> In-Reply-To: <20080409120025.5c4fd6f4@news01> References: <237967ef0804081708h72b87699n6235099044238a13@mail.gmail.com> <237967ef0804081711t6b4a9d88qa8b5367ba1ba8fb0@mail.gmail.com> <200804090849.m398n4W2012023@news01.csr.com> <20080409120025.5c4fd6f4@news01> Organization: CSR X-Mailer: Claws Mail 3.3.1 (GTK+ 2.12.5; i386-redhat-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-OriginalArrivalTime: 09 Apr 2008 11:20:53.0714 (UTC) FILETIME=[C6120B20:01C89A33] X-Scanned-By: MailControl A-08-00-05 (www.mailcontrol.com) on 10.68.0.142 X-Virus-Scanned: ClamAV 0.91.2/6681/Wed Apr 9 11:50:19 2008 on bifrost X-Virus-Status: Clean On Wed, 9 Apr 2008 12:00:25 +0100 Peter Stephenson wrote: > As far as _subscript is concerned, it would have to be taught the rules for > which characters can be backslashed, this applied with ${...//.../...}, and > then the -Q flag passed to compadd. This shouldn't be too hard. It wasn't. If you can find cases that still don't complete successfully it can be tweaked further. Index: Completion/Zsh/Context/_subscript =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_subscript,v retrieving revision 1.12 diff -u -r1.12 _subscript --- Completion/Zsh/Context/_subscript 13 Dec 2007 21:38:42 -0000 1.12 +++ Completion/Zsh/Context/_subscript 9 Apr 2008 11:18:39 -0000 @@ -67,12 +67,14 @@ _values -s '' 'subscript flags' $flags elif [[ ${(Pt)${compstate[parameter]}} = assoc* ]]; then - local suf + local suf MATCH MBEGIN MEND + local -a keys + keys=(${${(kP)compstate[parameter]}//(#m)[\$\\\[\]\(\)\[\{\}]/\\$MATCH}) [[ "$RBUFFER" != (|\\)\]* ]] && suf="$osuf" _wanted association-keys expl 'association key' \ - compadd -S "$suf" -k "$compstate[parameter]" + compadd -Q -S "$suf" -a keys elif [[ ${(Pt)${compstate[parameter]}} = array* ]]; then local list i j ret=1 disp -- Peter Stephenson Software Engineer CSR PLC, Churchill House, Cambridge Business Park, Cowley Road Cambridge, CB4 0WZ, UK Tel: +44 (0)1223 692070