diff options
-rw-r--r-- | ChangeLog | 4 | ||||
-rw-r--r-- | Completion/Core/_main_complete | 37 | ||||
-rw-r--r-- | Doc/Zsh/compsys.yo | 8 |
3 files changed, 39 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog index 3d835bd50..126e81a3a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,9 @@ 2000-06-29 Sven Wischnowsky <wischnow@zsh.org> + * 12114: Completion/Core/_main_complete, Doc/Zsh/compsys.yo: even + more fun with the menu style (no=num, yes=long-list, reverse + meaning of yes=num) + * 12113: Completion/Core/_expand, Src/Zle/zle_tricky.c: quote brace-strings diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index 402fe65ef..b541381be 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -170,8 +170,9 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then _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 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then 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 diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index 433df4807..a4f3f2214 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -1595,7 +1595,13 @@ 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. +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 |