diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-11 08:40:09 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2000-05-11 08:40:09 +0000 |
commit | d3620a02dfad71562320a90315175855b44ed4de (patch) | |
tree | a664abfb6e766b8c6a87f76b3c42e6221372506f /Completion/Core | |
parent | ed8b82b9b1bf74392caf4f4683f367bc4cbbd193 (diff) | |
download | zsh-d3620a02dfad71562320a90315175855b44ed4de.tar.gz zsh-d3620a02dfad71562320a90315175855b44ed4de.tar.xz zsh-d3620a02dfad71562320a90315175855b44ed4de.zip |
make ^G in menu-selection restore the old command line; add select=long* values for menu style to start menu-selection if list is too long for screen (11319)
Diffstat (limited to 'Completion/Core')
-rw-r--r-- | Completion/Core/_main_complete | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index 9882639fa..1b1fdd0e6 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -129,11 +129,20 @@ curcontext="${curcontext/:[^:]#:/::}" nm=$compstate[nmatches] if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then - [[ _last_nmatches -ge 0 && _last_nmatches -ne $compstate[nmatches] ]] && + [[ _last_nmatches -ge 0 && _last_nmatches -ne nm ]] && _menu_style=( "$_last_menu_style[@]" "$_menu_style[@]" ) - if [[ "$compstate[insert]" = "$_saved_insert" ]]; then - if [[ -n "$_menu_style[(r)(yes|true|1|on)]" || + tmp=$(( compstate[list_lines] + BUFFERLINES + 1 )) + + _menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" ) + + if [[ -z "$compstate[insert]" ]]; then + [[ -n "$_menu_style[(r)select=long-list]" && tmp -gt LINES ]] && + compstate[insert]=menu + elif [[ "$compstate[insert]" = "$_saved_insert" ]]; then + if [[ -n "$_menu_style[(r)select=long]" && tmp -gt LINES ]]; then + compstate[insert]=menu + elif [[ -n "$_menu_style[(r)(yes|true|1|on)]" || ( -n "$_menu_style[(r)auto*]" && "$compstate[insert]" = automenu ) ]]; then compstate[insert]=menu @@ -154,11 +163,12 @@ if [[ $compstate[old_list] = keep || nm -gt 1 ]]; then fi fi - _menu_style=( "$_menu_style[@]" "$_def_menu_style[@]" ) - if [[ "$compstate[insert]" = *menu* ]]; then if [[ -n "$_menu_style[(r)no-select*]" ]]; then unset MENUSELECT + elif [[ -n "$_menu_style[(r)select=long*]" && tmp -gt LINES ]]; then + zmodload -i zsh/complist + MENUSELECT=0 else sel=( "${(@M)_menu_style:#select*}" ) |