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

Re: Change in FIGNORE behavior



On Wed, 30 May 2007 10:45:29 +0100
Peter Stephenson <pws@xxxxxxx> wrote:
> > Even though FIGNORE is set, if there are no other matches,
> > completion should match the backup file, right?  That's the way the
> > shell used to behave.  I've done a little bisecting and it appears
> > this behavior changed sometime between 2007-05-15 and 007-05-23.
> 
> This is supposed to be handled by the _ignored completer;
> is some change causing that not to be set?  If not, maybe the output
> of _complete_debug would be helpful.

I've found what's causing it by using the default set of completers: it's
the effect of the change in (R) on this code in _ignored:

  zstyle -a ":completion:${curcontext}:" completer comp ||
    comp=( "${(@)_completers[1,_completer_num-1][(R)_ignored(|:*),-1]}" )

With

  _completers=(_complete _ignored)
  _completer_num=2

comp used to get set to _complete, now its empty.  It previously worked
because a failure to find _ignored(|:*) set the second start subscript to 0
which was interpreted as 1.  I presume the idea is we only want completers
starting from any previous occurence of _ignored, or the start.  This is a
bit too opaque for my liking anyway.  This expands that form where it
occurs in both _ignored and _prefix.

I'm glad somebody spotted this.

Index: Completion/Base/Completer/_ignored
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_ignored,v
retrieving revision 1.1
diff -u -r1.1 _ignored
--- Completion/Base/Completer/_ignored	2 Apr 2001 11:07:28 -0000	1.1
+++ Completion/Base/Completer/_ignored	30 May 2007 10:25:26 -0000
@@ -5,9 +5,13 @@
 [[ _matcher_num -gt 1 || $compstate[ignored] -eq 0 ]] && return 1
 
 local comp
+integer ind
 
-zstyle -a ":completion:${curcontext}:" completer comp ||
-  comp=( "${(@)_completers[1,_completer_num-1][(R)_ignored(|:*),-1]}" )
+if ! zstyle -a ":completion:${curcontext}:" completer comp; then
+  comp=( "${(@)_completers[1,_completer_num-1]}" )
+  ind=${comp[(I)_ignored(|:*)]}
+  (( ind )) && comp=("${(@)comp[ind,-1]}")
+fi
 
 local _comp_no_ignore=yes tmp expl \
       _completer _completer_num \
Index: Completion/Base/Completer/_prefix
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_prefix,v
retrieving revision 1.4
diff -u -r1.4 _prefix
--- Completion/Base/Completer/_prefix	5 Dec 2003 10:35:24 -0000	1.4
+++ Completion/Base/Completer/_prefix	30 May 2007 10:25:26 -0000
@@ -7,9 +7,13 @@
 local comp curcontext="$curcontext" tmp suf="$SUFFIX" \
       _completer \
       _matcher _c_matcher _matchers _matcher_num
+integer ind
 
-zstyle -a ":completion:${curcontext}:" completer comp ||
-  comp=( "${(@)_completers[1,_completer_num-1][(R)_prefix(|:*),-1]}" )
+if ! zstyle -a ":completion:${curcontext}:" completer comp; then
+  comp=( "${(@)_completers[1,_completer_num-1]}" )
+  ind=${comp[(I)_prefix(|:*)]}
+  (( ind )) && comp=("${(@)comp[ind,-1]}")
+fi
 
 if zstyle -t ":completion:${curcontext}:" add-space; then
   ISUFFIX=" $SUFFIX"


-- 
Peter Stephenson <pws@xxxxxxx>                  Software Engineer
CSR PLC, Churchill House, Cambridge Business Park, Cowley Road
Cambridge, CB4 0WZ, UK                          Tel: +44 (0)1223 692070


To access the latest news from CSR copy this link into a web browser:  http://www.csr.com/email_sig.php

To get further information regarding CSR, please visit our Investor Relations page at http://ir.csr.com/csr/about/overview



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