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

Re: tag-order problem



Borsenkow Andrej wrote:

> Just found problem in my _service/_services
> 
> _service calls _services to complete list of available services. Because
> _services normally completes both init and xinetd, I presumed I could
> limit matches by setting tag-order; in this case:
> 
> zstyle :completion::complete:service:argument-1: tag-order init -
> 
> (meaning - for the first argument of service somplete only tag `init').
> 
> It did restrict services set to init only - but it also stopped dead
> options completion.
> 
> Setting tags to `options init -' does allow options completion - both in
> first and second word as well; [...]

First, there was a buglet in _arguments that made option completion
use a context name containing the `argument-1'. Then there was a
buglet in _services because the loop wasn't left when completions were
produced. That's the reason why it didn't do what it should without
the `-' in tag-order.

With the two fixes it now works nicely for me (without `-').


Bye
  Sven

Index: Completion/Base/Utility/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_arguments,v
retrieving revision 1.11
diff -u -r1.11 _arguments
--- Completion/Base/Utility/_arguments	18 Feb 2002 14:27:38 -0000	1.11
+++ Completion/Base/Utility/_arguments	14 May 2002 08:03:32 -0000
@@ -335,9 +335,11 @@
          [[ -z "$hasopts" &&
             -z "$matched" &&
             ( -z "$aret" || "$PREFIX" = "$origpre" ) ]] &&
-          { ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
+          { ! zstyle -T ":completion:${oldcontext%:*}:options" prefix-needed ||
             [[ "$origpre" = [-+]* || -z "$aret$mesg$tried" ]] } ; then
-	local prevpre="$PREFIX" previpre="$IPREFIX"
+	local prevpre="$PREFIX" previpre="$IPREFIX" prevcontext="$curcontext"
+
+        curcontext="${oldcontext%:*}:options"
 
 	hasopts=yes
 
@@ -389,6 +391,7 @@
         fi
 	PREFIX="$prevpre"
 	IPREFIX="$previpre"
+        curcontext="$prevcontext"
       fi
       [[ -n "$tried" && "${${alwopt:+$origpre}:-$PREFIX}" != [-+]* ]] && break
     done
Index: Completion/Unix/Type/_services
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_services,v
retrieving revision 1.1
diff -u -r1.1 _services
--- Completion/Unix/Type/_services	8 May 2002 09:18:13 -0000	1.1
+++ Completion/Unix/Type/_services	14 May 2002 08:03:32 -0000
@@ -18,6 +18,7 @@
     compadd  -a inits && ret=0
   _requested xinetd expl 'xinetd services' \
     compadd  -a xinetds && ret=0
+  (( ret )) || break
 done
 
 return $ret

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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