From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.dk
Cc: Mario Lang <mlang@home.delysid.org>
Subject: PATCH: Re: Backticks and other tricks
Date: Wed, 28 Mar 2001 11:49:02 +0200 (MET DST) [thread overview]
Message-ID: <200103280949.LAA16960@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Wed, 28 Mar 2001 11:00:44 +0200 (MET DST)
[ moved to -workers ]
I wrote:
> ...
>
> if (( ! $+_ecasound_opts )); then
> local filters i
Since the filters array is to be used later it should of course be
before that `if' (or stored in a global _ecasound_filters array).
And I forgot to say that the values can be retrieved with
${(M)filters:#<name>:*}
or
${filters[(R)<name>:*]}
as in:
if [[ -n $state ]]; then
local what=${${(M)filters:#${state}:*}#*:*:} pat
pat="${${what//[^:]##}[2,-1]}"
pat="${pat//::/*,}"
if [[ $PREFIX = ${~pat}*, ]]; then
_message 'too many parameters'
else
while [[ -n $pat ]] && ! compset -P $pat; do
pat=$pat[3,-1]
what=${what%:*:*}
done
_message "${${what%:*}##*:} in ${what##*:}"
fi
fi
(I guess something like that was what Mario was aiming at).
Anyway, what I really wanted to say (and that's why it's on -workers):
if you try this with a `&& return 0' after the `_arguments ...' you'll
notice that competion after, e.g. `-ef1:' yields nothing. That's a
result of the change that removed the 300-return-value -- it has added
the option itself and hence `_arguments' returns zero. Ugly. Very.
I can't think of a completely satisfying solution now. Taking the
current option from the arrays of known options isn't good, because
then one wouldn't get offered an option `-foo' if that is already on
the line and there are other options starting with `-foo'.
So for now let's use the patch below. It adds the options only if
there is no `->state' action to use or if we are not in the same word
after the option.
Bye
Sven
Index: Completion/Base/_arguments
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/_arguments,v
retrieving revision 1.33
diff -u -r1.33 _arguments
--- Completion/Base/_arguments 2001/03/27 13:03:51 1.33
+++ Completion/Base/_arguments 2001/03/28 09:48:26
@@ -319,7 +319,8 @@
fi
done
- if [[ -z "$matched$hasopts" ]] && _requested options &&
+ if [[ -z "$matched$hasopts" && ( -z "$aret" || "$PREFIX" = "$origpre" ) ]] &&
+ _requested options &&
{ ! zstyle -T ":completion:${curcontext}:options" prefix-needed ||
[[ "$origpre" = [-+]* || -z "$aret$mesg$tried" ]] } ; then
local prevpre="$PREFIX" previpre="$IPREFIX"
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2001-03-28 9:49 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-03-28 9:49 Sven Wischnowsky [this message]
2001-03-28 15:20 ` Oliver Kiddle
2001-03-29 8:14 Sven Wischnowsky
2001-03-29 8:47 ` Bart Schaefer
2001-03-29 14:09 Sven Wischnowsky
2001-03-29 16:43 ` Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=200103280949.LAA16960@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=mlang@home.delysid.org \
--cc=zsh-workers@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).