From 0eebb6014cd13a1dd783b454cbeeff5e5918571e Mon Sep 17 00:00:00 2001 From: Tanaka Akira Date: Fri, 3 Dec 1999 08:55:11 +0000 Subject: zsh-workers/8864 --- Completion/Core/_description | 2 ++ Completion/Core/_files | 20 ++++++++++++++++---- Completion/Core/_main_complete | 4 ++++ Completion/Core/compinit | 13 +++++++------ Doc/Zsh/compsys.yo | 21 +++++++++++++++++++++ Doc/Zsh/compwid.yo | 4 ++-- Doc/Zsh/mod_complist.yo | 7 +++++++ Src/Zle/computil.c | 2 +- 8 files changed, 60 insertions(+), 13 deletions(-) diff --git a/Completion/Core/_description b/Completion/Core/_description index 54518e49f..0d28284ed 100644 --- a/Completion/Core/_description +++ b/Completion/Core/_description @@ -14,6 +14,8 @@ fi _lastdescr=( "$_lastdescr[@]" "$3" ) +_setup "$1" + _style -s descriptions format format _style -s "$1" group-name gname && [[ -z "$gname" ]] && gname="$1" diff --git a/Completion/Core/_files b/Completion/Core/_files index 9c5b45693..32d78dba1 100644 --- a/Completion/Core/_files +++ b/Completion/Core/_files @@ -27,19 +27,31 @@ esac while _tags; do if _requested all-files; then - (( $#group )) && group[2]=all-files + if (( $#group )); then + group[2]=all-files + _setup all-files + fi _path_files "$opts[@]" -f return elif _requested directories; then if _requested globbed-files; then - (( $#group )) && group[2]=globbed-files + if (( $#group )); then + group[2]=globbed-files + _setup globbed-files + fi _path_files "$opts[@]" -/g "$type" && return 0 else - (( $#group )) && group[2]=directories + if (( $#group )); then + group[2]=directories + _setup directories + fi _path_files "$opts[@]" -/ && return 0 fi elif _requested globbed-files; then - (( $#group )) && group[2]=globbed-files + if (( $#group )); then + group[2]=globbed-files + _setup globbed-files + fi _path_files "$opts[@]" -g "$type" && return 0 fi done diff --git a/Completion/Core/_main_complete b/Completion/Core/_main_complete index c23ce41cd..4dd3bd218 100644 --- a/Completion/Core/_main_complete +++ b/Completion/Core/_main_complete @@ -39,6 +39,10 @@ elif [[ "$PREFIX" != */* && "$PREFIX[1]" = '~' ]]; then compstate[context]=tilde fi +# Initial setup. + +_setup default + # Get the names of the completers to use in the positional parameters. if (( ! $# )); then diff --git a/Completion/Core/compinit b/Completion/Core/compinit index b313edede..06586cdc4 100644 --- a/Completion/Core/compinit +++ b/Completion/Core/compinit @@ -487,12 +487,13 @@ compstyle() { # Default styles. This should be executed conditionally somehow. -compstyle '*' verbose 'yes' -compstyle '*' prefix-needed 'yes' -compstyle '*' prefix-hidden 'no' -compstyle ':correct' accept '2n' -compstyle ':correct' prompt 'correct to:' -compstyle '*' completer '_complete' +compstyle '*' verbose 'yes' +compstyle '*' prefix-needed 'yes' +compstyle '*' prefix-hidden 'no' +compstyle ':correct' accept '2n' +compstyle ':correct' prompt 'correct to:' +compstyle '*' completer '_complete' +compstyle '*:default' list-colors no=0 fi=0 di=0 ln=0 pi=0 so=0 bd=0 cd=0 ex=0 # Now we automatically make the definition files autoloaded. diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo index fcfd77cc0..9517cc8d9 100644 --- a/Doc/Zsh/compsys.yo +++ b/Doc/Zsh/compsys.yo @@ -964,6 +964,27 @@ item(tt(list-arguments))( Like the tt(arguments) style, but used when calling the tt(ps) command to generate the list to display. ) +item(tt(list-colors))( +If the tt(complist) module is used, this style can be used to set +color specifications as with the tt(ZLS_COLORS) and tt(ZLS_COLOURS) +parameters (see +ifzman(the section `The complist Module' in zmanref(zshmodules))\ +ifnzman(noderef(The complist Module))\ +). + +If this style is set for the tt(default) tag, the strings in the value +are taken as specifications that are to be used everywhere. If it is +set for other tags, the specifications are used only for matches of +the type described by the tag. + +To be able to share the same specifications one has set up for the GNU +version of the tt(ls) command one can use: + +example(compstyle '*:default' list-colors ${(s.:.)LS_COLORS}) + +And to get the default colors (which are the same as for the GNU +tt(ls) command) one should set the style to an empty value. +) item(tt(local))( This style is used by completion functions which generate URLs as possible matches to add suitable matches when a URL points to a diff --git a/Doc/Zsh/compwid.yo b/Doc/Zsh/compwid.yo index b5ebb4f8e..89e4f97ca 100644 --- a/Doc/Zsh/compwid.yo +++ b/Doc/Zsh/compwid.yo @@ -372,7 +372,7 @@ sect(Builtin Commands) startitem() findex(compadd) cindex(completion widgets, adding specified matches) -xitem(tt(compadd) [ tt(-qQfenUaml12) ] [ tt(-F) var(array) ]) +xitem(tt(compadd) [ tt(-qQfenUal12) ] [ tt(-F) var(array) ]) xitem([ tt(-P) var(prefix) ] [ tt(-S) var(suffix) ]) xitem([ tt(-p) var(hidden-prefix) ] [ tt(-s) var(hidden-suffix) ]) xitem([ tt(-i) var(ignored-prefix) ] [ tt(-I) var(ignored-suffix) ]) @@ -449,7 +449,7 @@ ignored. ) item(tt(-l))( This option only has an effect if used together with the tt(-d) -options. If it is given, the display strings are listed one per line, +option. If it is given, the display strings are listed one per line, not arrayed in columns. ) item(tt(-J) var(name))( diff --git a/Doc/Zsh/mod_complist.yo b/Doc/Zsh/mod_complist.yo index 02ae210c5..53162d6b4 100644 --- a/Doc/Zsh/mod_complist.yo +++ b/Doc/Zsh/mod_complist.yo @@ -118,6 +118,13 @@ The default values are ISO 6429 (ANSI) compliant and can be used on vt100 compatible terminals such as tt(xterm)s. On monochrome terminals the default values will have no visual effect. +If the shell function based completion system is used, these +parameters should not be set directly because the system controls them +itself. Instead, the tt(list-colors) style should be used (see +ifzman(the section `Completion System Configuration' in zmanref(zshcompsys))\ +ifnzman(noderef(Completion System Configuration))\ +). + subsect(Menu selection) cindex(completion, selecting by cursor) vindex(SELECTMIN) diff --git a/Src/Zle/computil.c b/Src/Zle/computil.c index 74b395e9b..c43fdfd0c 100644 --- a/Src/Zle/computil.c +++ b/Src/Zle/computil.c @@ -2436,7 +2436,7 @@ bin_compstyles(char *nam, char **args, char *ops, int func) return 1; } switch (args[0][1]) { - case 'a': min = 3; max = -1; break; + case 'a': min = 2; max = -1; break; case 'd': min = 0; max = 2; break; case 'S': min = 3; max = 3; break; case 'A': min = 3; max = 3; break; -- cgit 1.4.1