Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: PATCH: Improve handling of b/n/s subscript flags



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



Messages sorted by: Reverse Date, Date, Thread, Author