1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-29 06:51:03 +02:00

reverse meaning of yes=num again (12122)

This commit is contained in:
Sven Wischnowsky 2000-06-29 09:32:04 +00:00
parent a9d46be89d
commit d01795be2a
3 changed files with 27 additions and 26 deletions

View file

@ -1,5 +1,8 @@
2000-06-29 Sven Wischnowsky <wischnow@zsh.org> 2000-06-29 Sven Wischnowsky <wischnow@zsh.org>
* 12122: Completion/Core/_main_complete: reverse meaning of yes=num
again
* 12119: Completion/Core/_complete, Completion/Core/_normal: try * 12119: Completion/Core/_complete, Completion/Core/_normal: try
to return the right value to return the right value

View file

@ -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 min i num\ local func funcs ret=1 tmp _compskip format nm call match min max 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" \
@ -181,7 +181,7 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" ) sel=( "${(@M)_menu_style:#(yes|true|1|on)*}" )
if (( $#sel )); then if (( $#sel )); then
min=0 min=9999999
for i in "$sel[@]"; do for i in "$sel[@]"; do
if [[ "$i" = *\=* ]]; then if [[ "$i" = *\=* ]]; then
num="${i#*\=}" num="${i#*\=}"
@ -189,38 +189,36 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then
else else
num=$nm num=$nm
fi fi
[[ num -gt min ]] && min="$num" [[ num -lt min ]] && min="$num"
[[ min -ge nm ]] && break (( min )) || break
done done
fi fi
if [[ ( -n "$min" && nm -le min ) || sel=( "${(@M)_menu_style:#(no|false|0|off)*}" )
if (( $#sel )); then
max=9999999
for i in "$sel[@]"; do
if [[ "$i" = *\=* ]]; then
num="${i#*\=}"
[[ num -lt 0 ]] && num=0
else
num=0
fi
[[ num -lt max ]] && max="$num"
(( max )) || break
done
fi
if [[ ( -n "$min" && nm -ge min && ( -z "$max" || nm -lt max ) ) ||
( -n "$_menu_style[(r)auto*]" && ( -n "$_menu_style[(r)auto*]" &&
"$compstate[insert]" = automenu ) ]]; then "$compstate[insert]" = automenu ) ]]; then
compstate[insert]=menu compstate[insert]=menu
elif [[ -n "$max" && nm -ge max ]]; then
compstate[insert]=unambiguous
elif [[ -n "$_menu_style[(r)auto*]" && elif [[ -n "$_menu_style[(r)auto*]" &&
"$compstate[insert]" != automenu ]]; then "$compstate[insert]" != automenu ]]; then
compstate[insert]=automenu-unambiguous compstate[insert]=automenu-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 fi
fi fi

View file

@ -1595,7 +1595,7 @@ example, with the tt(MENU_COMPLETE) option).
Using the form `tt(yes=)var(num)', where `tt(yes)' may be any of the 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 true values (`tt(yes)', `tt(true)', `tt(on)' and `tt(1)') turns on
menu completion if there at most var(num) matches. Using this for one menu completion if there at least var(num) matches. Using this for one
of the `false' values (as in `tt(no=10)') makes menu completion 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, 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 this is only useful when menu completion is normally used, e.g. by