From: Sven Wischnowsky <wischnow@informatik.hu-berlin.de>
To: zsh-workers@sunsite.auc.dk
Subject: Re: PATCH: Re: (forw) --help able programs and completion]
Date: Thu, 29 Jun 2000 09:02:40 +0200 (MET DST) [thread overview]
Message-ID: <200006290702.JAA04157@beta.informatik.hu-berlin.de> (raw)
In-Reply-To: Sven Wischnowsky's message of Wed, 28 Jun 2000 09:08:04 +0200 (MET DST)
I wrote:
> [ the menu style and `yes=<num>' ]
>
> Another question is if it should mean `if there are less than <num>
> matches, start menu completion', because menu completion (at least the
> *real* menu completion, not selection) works best with few matches.
>
> That's easy to change, though (I'd like to get opinions from menu
> completion users).
This patch does that (as long as I don't get replies, I'll happily
continue hacking).
> > > Does anybody now want support for `no=3'?
> >
> > Which would mean ...?
>
> If one has `setopt menucomplete', setting the menu style to one of the
> `false' values can be used to turn menu completion off for some
> contexts. Allowing `no=<num>' would either mean to turn it of if there
> are more or less than <num> matches, whatever we decide `yes=<num>'
> means.
It also does this (with `if there are at least <num> matches, don't
start menu completion').
> > However, a plain-ol'-menu-completion variant of select=long-list might be
> > interesting.
>
> Hmhm, right.
And it does this (`yes=long-list').
Bye
Sven
Index: Completion/Core/_main_complete
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Core/_main_complete,v
retrieving revision 1.32
diff -u -r1.32 _main_complete
--- Completion/Core/_main_complete 2000/06/28 09:42:51 1.32
+++ Completion/Core/_main_complete 2000/06/29 07:02:03
@@ -170,8 +170,9 @@
_menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" )
- if [[ "$compstate[list]" = *list &&
- -n "$_menu_style[(r)select=long-list]" && tmp -gt LINES ]]; then
+ if [[ "$compstate[list]" = *list && tmp -gt LINES &&
+ ( -n "$_menu_style[(r)select=long-list]" ||
+ -n "$_menu_style[(r)(yes|true|on|1)=long-list]" ) ]]; then
compstate[insert]=menu
elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then
if [[ -n "$_menu_style[(r)select=long]" && tmp -gt LINES ]]; then
@@ -180,28 +181,46 @@
sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" )
if (( $#sel )); then
- min=9999999
+ min=0
for i in "$sel[@]"; do
if [[ "$i" = *\=* ]]; then
num="${i#*\=}"
[[ num -lt 0 ]] && num=0
else
- num=0
+ num=$nm
fi
- [[ num -lt min ]] && min="$num"
+ [[ num -gt min ]] && min="$num"
- (( min )) || break
+ [[ min -ge nm ]] && break
done
fi
- if [[ ( -n "$min" && nm -ge min ) ||
+ if [[ ( -n "$min" && nm -le min ) ||
( -n "$_menu_style[(r)auto*]" &&
"$compstate[insert]" = automenu ) ]]; then
compstate[insert]=menu
elif [[ -n "$_menu_style[(r)auto*]" &&
"$compstate[insert]" != automenu ]]; then
compstate[insert]=automenu-unambiguous
- elif [[ -n "$_menu_style[(r)(no|false|0|off)]" ]]; then
- compstate[insert]=unambiguous
+ else
+ sel=( "${(@M)_menu_style:#(no|false|0|off)*}" )
+
+ if (( $#sel )); then
+ min=9999999
+ for i in "$sel[@]"; do
+ if [[ "$i" = *\=* ]]; then
+ num="${i#*\=}"
+ [[ num -lt 0 ]] && num=0
+ else
+ num=0
+ fi
+ [[ num -lt min ]] && min="$num"
+
+ (( min )) || break
+ done
+ else
+ min=
+ fi
+ [[ -n "$min" && nm -ge min ]] && compstate[insert]=unambiguous
fi
fi
fi
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.77
diff -u -r1.77 compsys.yo
--- Doc/Zsh/compsys.yo 2000/06/28 09:08:03 1.77
+++ Doc/Zsh/compsys.yo 2000/06/29 07:02:04
@@ -1595,7 +1595,13 @@
Using the form `tt(yes=)var(num)', where `tt(yes)' may be any of the
true values (`tt(yes)', `tt(true)', `tt(on)' and `tt(1)') turns on
-menu completion if there at least var(num) matches.
+menu completion if there at most var(num) matches. Using this for one
+of the `false' values (as in `tt(no=10)') makes menu completion
+em(not) be used if there are var(num) or more matches. Of course,
+this is only useful when menu completion is normally used, e.g. by
+setting the tt(MENU_COMPLETE) option. The `true' values may also be
+used in the form `tt(yes=long-list)' to turn on menu completion
+whenever listing is done and the list does not fit onto the screen.
In addition to (or instead of) the above possibilities, the value may
contain the string `tt(select)', optionally followed by an equal sign and a
--
Sven Wischnowsky wischnow@informatik.hu-berlin.de
next reply other threads:[~2000-06-29 7:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-06-29 7:02 Sven Wischnowsky [this message]
2000-06-29 9:04 ` Peter Stephenson
-- strict thread matches above, loose matches on Subject: below --
2000-06-29 9:27 Sven Wischnowsky
2000-06-28 7:08 Sven Wischnowsky
[not found] <200006271502.RAA30019@beta.informatik.hu-berlin.de>
2000-06-27 22:46 ` Bart Schaefer
2000-06-27 15:06 Sven Wischnowsky
2000-06-27 13:18 Sven Wischnowsky
2000-06-27 15:02 ` 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=200006290702.JAA04157@beta.informatik.hu-berlin.de \
--to=wischnow@informatik.hu-berlin.de \
--cc=zsh-workers@sunsite.auc.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).