Zsh Mailing List Archive
Messages sorted by:
Re: adding the original string as a completion match
- X-seq: zsh-workers 16923
- From: Oliver Kiddle <okiddle@xxxxxxxxxxx>
- To: Sven Wischnowsky <wischnow@xxxxxxxxx>
- Subject: Re: adding the original string as a completion match
- Date: Thu, 28 Mar 2002 17:01:19 +0000
- Cc: zsh-workers@xxxxxxxxxx
- In-reply-to: <15522.60735.419805.36569@xxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-workers-help@xxxxxxxxxx; run by ezmlm
- References: <20020327111020.GA15630@xxxxxxxxxx> <15522.60735.419805.36569@xxxxxxxxxxxxxxxxxx>
- Sender: Oliver Kiddle <kiddleo@xxxxxxxxxx>
Sven Wischnowsky wrote:
> Something like _all_matches is problematic because whether menu
> completion is to be used is decided very late, after all the
> completers have been called. It would be easier to add a style tested
> by _main_complete itself saying whether the original string should be
> added as a match or only as a description. Other function could
Looking at where in _main_complete I would need to add this, it seems
that it could be done with a post function setup from a completer which
would be like _all_matches. Your suggestion is probably better though.
I tried this:
if [[ $compstate[insert] = *menu* && "$compstate[nmatches]" -gt 1 &&
-n $PREFIX$SUFFIX ]]; then
_description -V original expl original
compadd "$expl[@]" -U -Q - "$PREFIX$SUFFIX"
There needs to be more things in the if condition though. In
particular, it has problems when the matches added are added after part
of PREFIX will have been moved to IPREFIX, e.g. cd Mail/<tab> results
in the slash being removed. Any idea on how to get it working or if it
is even possible? If not, I'll commit the _match change instead.
> > And another question, is there any way with _all_matches that I can get
> > it to just insert all the matches and never list all the things which
> There should be a possibility for this by setting compstate[insert]=-1
> after _all_matches added that all-matches-match. Haven't tried,
That didn't seem to work but compstate[insert]=all does the job. Hence
the following patch.
RCS file: /cvsroot/zsh/zsh/Completion/Base/Completer/_all_matches,v
retrieving revision 1.1
diff -u -r1.1 _all_matches
--- Completion/Base/Completer/_all_matches 2 Apr 2001 11:05:27 -0000 1.1
+++ Completion/Base/Completer/_all_matches 28 Mar 2002 16:53:05 -0000
@@ -33,8 +33,12 @@
if [[ "$compstate[nmatches]" -gt 1 && $not[(I)(|_)$_completer] -eq 0 ]]; then
- _description all-matches expl 'all matches'
- compadd "$expl[@]" -C
+ if zstyle -t "$_all_matches_context" insert; then
+ _description all-matches expl 'all matches'
+ compadd "$expl[@]" -C
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.152
diff -u -r1.152 compsys.yo
--- Doc/Zsh/compsys.yo 27 Mar 2002 16:10:11 -0000 1.152
+++ Doc/Zsh/compsys.yo 28 Mar 2002 16:53:06 -0000
@@ -1461,6 +1461,11 @@
tt(EXTENDED_GLOB) option is in effect, so the characters `tt(#)',
`tt(~)' and `tt(^)' have special meanings in the patterns.
+kindex(insert, completion style)
+This style is used by the tt(_all_matches) completer to decide whether to
+insert the list of all matches instead of adding it as another match.
kindex(insert-ids, completion style)
When completing process IDs, for example as arguments to the tt(kill) and
This e-mail and any attachment is for authorised use by the intended recipient(s) only. It may contain proprietary material, confidential information and/or be subject to legal privilege. It should not be copied, disclosed to, retained or used by, any other party. If you are not an intended recipient then please promptly delete this e-mail and any attachment and all copies and inform the sender. Thank you.
Messages sorted by: