* tag-order problem
@ 2002-05-11 10:48 Borsenkow Andrej
2002-05-13 9:09 ` Sven Wischnowsky
2002-05-14 8:06 ` Sven Wischnowsky
0 siblings, 2 replies; 6+ messages in thread
From: Borsenkow Andrej @ 2002-05-11 10:48 UTC (permalink / raw)
To: Zsh hackers list
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; third and subsequent are completed
normally (after -TAB three times:
{pts/2}% service --debug --full-restart httpd-naat
Completing init services
httpd-naat syslog-ng
Looking in traces, it seems that
_arguments in _service correctly setups requested tags (that are
argument-1 and options) and does not use the above tag-order style at
all
first call to _tags in tags loop is O.K.; next `_requested argument-1'
also returns true
next call to _tags is still true
but call to `_requested options' fails.
If no tag-order is defined it works correctly but then both sets are
listed (that I'd like to avoid).
-andrej
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tag-order problem
2002-05-11 10:48 tag-order problem Borsenkow Andrej
@ 2002-05-13 9:09 ` Sven Wischnowsky
2002-05-14 8:06 ` Sven Wischnowsky
1 sibling, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 2002-05-13 9:09 UTC (permalink / raw)
To: zsh-workers
Borsenkow Andrej wrote:
> ...
>
> If no tag-order is defined it works correctly but then both sets are
> listed (that I'd like to avoid).
The `-' special value is probably not as thoroughly tested as it
should be, I'll have a look.
Bye
Sven
--
Sven Wischnowsky wischnow@berkom.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tag-order problem
2002-05-11 10:48 tag-order problem Borsenkow Andrej
2002-05-13 9:09 ` Sven Wischnowsky
@ 2002-05-14 8:06 ` Sven Wischnowsky
1 sibling, 0 replies; 6+ messages in thread
From: Sven Wischnowsky @ 2002-05-14 8:06 UTC (permalink / raw)
To: zsh-workers
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@berkom.de
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: tag-order problem.
2000-05-30 14:22 Tanaka Akira
@ 2000-05-30 17:12 ` Bart Schaefer
0 siblings, 0 replies; 6+ messages in thread
From: Bart Schaefer @ 2000-05-30 17:12 UTC (permalink / raw)
To: Tanaka Akira, zsh-workers
On May 30, 11:22pm, Tanaka Akira wrote:
} Subject: tag-order problem.
}
} I found that tag-order prevents some of completions.
(Peter, I'm afraid you're going to have to re-do this release. Good thing
you didn't "really" announce it yet.)
} Z(3):akr@serein% Src/zsh -f
} serein% bindkey -e;autoload -U compinit; compinit -D
} serein% zstyle ':completion:*' tag-order '*:label'
} serein% which <TAB>
}
} This completes nothing.
I used the example of completing after `lynx' because _lynx has not been
edited since before this broke, whereas _which was changed recently.
The problem is with the change to _arguments to use a counter instead of
a shift when going around this nested loop:
while _tags; do
anum=1
while [[ anum -le $#descrs ]]; do
action="$actions[anum]"
descr="$descrs[anum]"
subc="$subcs[anum++]"
# lots deleted
done
# lots more deleted
done
In the previous implementation, `shift descrs' at the point where I've put
`# lots deleted' would mean that the inner while loop consumed all the
descriptions on the first time around the _tags loop, so they were not
tried again for the second and succeeding tags. Now, all the descriptions
are tried for every tag. I'm not sure if that's what Sven intended, but
it breaks the `all tags not explicitly selected are tried last' behavior
in some way.
As a fast workaround, stick `descrs=()' after the inner `done', i.e. where
I've got `#lots more deleted' in the snippet above. That's probably not
the correct fix ....
--
Bart Schaefer Brass Lantern Enterprises
http://www.well.com/user/barts http://www.brasslantern.com
Zsh: http://www.zsh.org | PHPerl Project: http://phperl.sourceforge.net
^ permalink raw reply [flat|nested] 6+ messages in thread
* tag-order problem.
@ 2000-05-30 14:22 Tanaka Akira
2000-05-30 17:12 ` Bart Schaefer
0 siblings, 1 reply; 6+ messages in thread
From: Tanaka Akira @ 2000-05-30 14:22 UTC (permalink / raw)
To: zsh-workers
I found that tag-order prevents some of completions.
Z(3):akr@serein% Src/zsh -f
serein% bindkey -e;autoload -U compinit; compinit -D
serein% zstyle ':completion:*' tag-order '*:label'
serein% which <TAB>
This completes nothing.
Note that
serein% lynx <TAB>
serein% gzip <TAB>
serein% compress <TAB>
etc. have same problem.
--
Tanaka Akira
^ permalink raw reply [flat|nested] 6+ messages in thread
* tag-order problem
@ 2000-05-10 16:56 Tanaka Akira
0 siblings, 0 replies; 6+ messages in thread
From: Tanaka Akira @ 2000-05-10 16:56 UTC (permalink / raw)
To: zsh-workers
Z(4):akr@serein% Src/zsh -f
serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
serein% zstyle ':completion:*' group-name ''
serein% zstyle ':completion:*:messages' format %d
serein% zstyle ':completion:*:descriptions' format %d
serein% zstyle ':completion:*:*:foo:*' tag-order '*' '*:-case'
serein% zstyle ':completion:*-case' matcher 'm:{a-z}={A-Z}'
serein% foo c<TAB>
file
config.cache config.h config.log config.sub* configure.in
config.guess* config.h.in config.status* configure*
file
CVS/ Completion/ config.guess* config.log configure*
ChangeLog Config/ config.h config.status* configure.in
ChangeLog.3.0 config.cache config.h.in config.sub*
I think it shouldn't completes two file sets at once.
--
Tanaka Akira
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2002-05-14 8:06 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-11 10:48 tag-order problem Borsenkow Andrej
2002-05-13 9:09 ` Sven Wischnowsky
2002-05-14 8:06 ` Sven Wischnowsky
-- strict thread matches above, loose matches on Subject: below --
2000-05-30 14:22 Tanaka Akira
2000-05-30 17:12 ` Bart Schaefer
2000-05-10 16:56 Tanaka Akira
Code repositories for project(s) associated with this public inbox
https://git.vuxu.org/mirror/zsh/
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).