zsh-workers
 help / color / mirror / code / Atom feed
From: Oliver Kiddle <okiddle@yahoo.co.uk>
To: Sven Wischnowsky <wischnow@berkom.de>
Cc: zsh-workers@sunsite.dk
Subject: Re: adding the original string as a completion match
Date: Thu, 28 Mar 2002 17:01:19 +0000	[thread overview]
Message-ID: <20020328170119.GA29498@logica.com> (raw)
In-Reply-To: <15522.60735.419805.36569@wischnow.berkom.de>

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"
  fi

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,
> though...

That didn't seem to work but compstate[insert]=all does the job. Hence
the following patch.

Thanks Sven.

Oliver

Index: Completion/Base/Completer/_all_matches
===================================================================
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
     local expl
 
-    _description all-matches expl 'all matches'
-    compadd "$expl[@]" -C
+    if zstyle -t "$_all_matches_context" insert; then
+      compstate[insert]=all
+    else
+      _description all-matches expl 'all matches'
+      compadd "$expl[@]" -C
+    fi
   fi
 
   unset _all_matches_context
Index: Doc/Zsh/compsys.yo
===================================================================
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)
+item(tt(insert))(
+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)
 item(tt(insert-ids))(
 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.


      reply	other threads:[~2002-03-28 17:01 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-03-27 11:10 Oliver Kiddle
2002-03-28 10:15 ` Sven Wischnowsky
2002-03-28 17:01   ` Oliver Kiddle [this message]

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=20020328170119.GA29498@logica.com \
    --to=okiddle@yahoo.co.uk \
    --cc=wischnow@berkom.de \
    --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).