From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16025 invoked from network); 8 May 2001 11:51:32 -0000 Received: from sunsite.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 8 May 2001 11:51:32 -0000 Received: (qmail 24410 invoked by alias); 8 May 2001 11:51:09 -0000 Mailing-List: contact zsh-workers-help@sunsite.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 14256 Received: (qmail 24396 invoked from network); 8 May 2001 11:51:08 -0000 Sender: kiddleo Message-ID: <3AF7DDAB.72A6000F@u.genie.co.uk> Date: Tue, 08 May 2001 12:51:07 +0100 From: Oliver Kiddle X-Mailer: Mozilla 4.76 [en] (X11; U; Linux 2.2.15 i686) X-Accept-Language: en MIME-Version: 1.0 To: zsh-workers@sunsite.dk Subject: Re: PATCH: Improve handling of b/n/s subscript flags References: <1010506194240.ZM21879@candle.brasslantern.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit This is great, thanks. There was one tiny mistake which I fix here. Bart Schaefer wrote: > > I've included code to handle e.g. (s[string]), but with `$scalar[(s[' on the > line we arrive in _subscript with the `(s[' already moved into $IPREFIX and > so `compset -P \(' fails and we branch into `_contexts -math-'. I'm not > sure what code has to change to fix this; I suspect it's in C somewhere. It'll be whatever C code decides the current context. This has never been perfect for determining whether we are in a subscript hence the completion of character classes in _subscript. If we want similar completion for zsh's various other flags, then I expect it is the same bit of code that needs updating to give us access to those areas in shell code. > The next change to make to this is to discover that i/I/r/R are in the flags > and NOT complete in math context (for arrays) or association keys (assoc's). Yes, and complete array style indexes for split scalars. Oliver Index: Completion/Zsh/Context/_subscript =================================================================== RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_subscript,v retrieving revision 1.4 diff -u -r1.4 _subscript --- Completion/Zsh/Context/_subscript 2001/05/06 22:35:08 1.4 +++ Completion/Zsh/Context/_subscript 2001/05/08 11:49:49 @@ -20,7 +20,7 @@ if [[ $PREFIX = (#b)*([bns])(?|)(*) ]]; then local f=$match[1] d=$match[2] e=$match[2] v=$match[3] - [[ $f = s && ${(Pt)${compstate[parameter]}} != scalar ]] && return 1 + [[ $f = s && ${(Pt)${compstate[parameter]}} != scalar* ]] && return 1 if [[ -z $d ]]; then _message 'delimiter' return