mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-04 08:30:54 +02:00
menu style accepts yes=x to start menu completion if there are at least x matches (3219)
This commit is contained in:
parent
c8812bb0c8
commit
9eca7fc726
3 changed files with 37 additions and 21 deletions
|
@ -1,5 +1,9 @@
|
||||||
2000-06-27 Sven Wischnowsky <wischnow@zsh.org>
|
2000-06-27 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 3219: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: menu
|
||||||
|
style accepts yes=x to start menu completion if there are at least
|
||||||
|
x matches
|
||||||
|
|
||||||
* Andrej: 12084: Src/Modules/zpty.c: don't close slave if not yet open
|
* Andrej: 12084: Src/Modules/zpty.c: don't close slave if not yet open
|
||||||
|
|
||||||
* 12082: Doc/Zsh/compsys.yo: document _use_lo
|
* 12082: Doc/Zsh/compsys.yo: document _use_lo
|
||||||
|
|
|
@ -23,7 +23,7 @@ exec </dev/null # ZLE closes stdin, which can cause errors
|
||||||
# Failed returns from this code are not real errors
|
# Failed returns from this code are not real errors
|
||||||
setopt localtraps noerrexit ; trap - ZERR
|
setopt localtraps noerrexit ; trap - ZERR
|
||||||
|
|
||||||
local func funcs ret=1 tmp _compskip format nm call match \
|
local func funcs ret=1 tmp _compskip format nm call match min i num\
|
||||||
_completers _completer _completer_num curtag _comp_force_list \
|
_completers _completer _completer_num curtag _comp_force_list \
|
||||||
_matchers _matcher _matcher_num _comp_tags _comp_mesg \
|
_matchers _matcher _matcher_num _comp_tags _comp_mesg \
|
||||||
context state line opt_args val_args curcontext="$curcontext" \
|
context state line opt_args val_args curcontext="$curcontext" \
|
||||||
|
@ -175,24 +175,33 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
|
||||||
elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then
|
elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then
|
||||||
if [[ -n "$_menu_style[(r)select=long]" && tmp -gt LINES ]]; then
|
if [[ -n "$_menu_style[(r)select=long]" && tmp -gt LINES ]]; then
|
||||||
compstate[insert]=menu
|
compstate[insert]=menu
|
||||||
elif [[ -n "$_menu_style[(r)(yes|true|1|on)]" ||
|
else
|
||||||
( -n "$_menu_style[(r)auto*]" &&
|
sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" )
|
||||||
"$compstate[insert]" = automenu ) ]]; then
|
|
||||||
compstate[insert]=menu
|
if (( $#sel )); then
|
||||||
elif [[ -n "$_menu_style[(r)auto*]" &&
|
min=9999999
|
||||||
"$compstate[insert]" != automenu ]]; then
|
for i in "$sel[@]"; do
|
||||||
compstate[insert]=automenu-unambiguous
|
if [[ "$i" = *\=* ]]; then
|
||||||
elif [[ -n "$_menu_style[(r)(no|false|0|off)]" ]]; then
|
num="${i#*\=}"
|
||||||
compstate[insert]=unambiguous
|
[[ num -lt 0 ]] && num=0
|
||||||
elif [[ -n "$_def_menu_style[(r)(yes|true|1|on)]" ||
|
else
|
||||||
( -n "$_def_menu_style[(r)auto*]" &&
|
num=0
|
||||||
"$compstate[insert]" = automenu ) ]]; then
|
fi
|
||||||
compstate[insert]=menu
|
[[ num -lt min ]] && min="$num"
|
||||||
elif [[ -n "$_def_menu_style[(r)auto*]" &&
|
|
||||||
"$compstate[insert]" != automenu ]]; then
|
(( min )) || break
|
||||||
compstate[insert]=automenu-unambiguous
|
done
|
||||||
elif [[ -n "$_def_menu_style[(r)(no|false|0|off)]" ]]; then
|
fi
|
||||||
compstate[insert]=unambiguous
|
if [[ ( -n "$min" && nm -ge 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
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -209,8 +218,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
|
||||||
sel=( "${(@M)_menu_style:#select*}" )
|
sel=( "${(@M)_menu_style:#select*}" )
|
||||||
|
|
||||||
if (( $#sel )); then
|
if (( $#sel )); then
|
||||||
local min=9999999 i num
|
min=9999999
|
||||||
|
|
||||||
for i in "$sel[@]"; do
|
for i in "$sel[@]"; do
|
||||||
if [[ "$i" = *\=* ]]; then
|
if [[ "$i" = *\=* ]]; then
|
||||||
num="${i#*\=}"
|
num="${i#*\=}"
|
||||||
|
|
|
@ -1593,6 +1593,10 @@ option. Finally, if one of the values is explicitly set to false, menu
|
||||||
completion will be turned off even if it would otherwise be active (for
|
completion will be turned off even if it would otherwise be active (for
|
||||||
example, with the tt(MENU_COMPLETE) option).
|
example, with the tt(MENU_COMPLETE) option).
|
||||||
|
|
||||||
|
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.
|
||||||
|
|
||||||
In addition to (or instead of) the above possibilities, the value may
|
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
|
contain the string `tt(select)', optionally followed by an equal sign and a
|
||||||
number. In this case menu-selection (as defined by the tt(zsh/complist)
|
number. In this case menu-selection (as defined by the tt(zsh/complist)
|
||||||
|
|
Loading…
Reference in a new issue