From 753cc6b22adb659e9c6bdcf854d99bfe4b731d26 Mon Sep 17 00:00:00 2001 From: Sven Wischnowsky Date: Tue, 2 May 2000 08:23:31 +0000 Subject: completion cleanup, mostly _wanted and $expl (11049) --- Completion/Base/_arguments | 11 ++++++----- Completion/Base/_first | 2 +- Completion/Builtins/_hash | 2 +- Completion/Core/_expand | 6 ++---- Completion/User/_gprof | 2 +- Completion/User/_mount | 2 +- Completion/User/_socket | 3 +-- Completion/User/_urls | 2 +- 8 files changed, 14 insertions(+), 16 deletions(-) (limited to 'Completion') diff --git a/Completion/Base/_arguments b/Completion/Base/_arguments index b1e790e1c..38002ccf6 100644 --- a/Completion/Base/_arguments +++ b/Completion/Base/_arguments @@ -298,14 +298,15 @@ if (( $# )) && comparguments "$multi[@]" "$autod" "$@"; then if comparguments -s single; then - _description options expl option - if [[ "$single" = direct ]]; then - compadd "$expl[@]" -QS '' - "${PREFIX}${SUFFIX}" + _all_labels options expl option \ + compadd -QS '' - "${PREFIX}${SUFFIX}" elif [[ "$single" = next ]]; then - compadd "$expl[@]" -Q - "${PREFIX}${SUFFIX}" + _all_labels options expl option \ + compadd -Q - "${PREFIX}${SUFFIX}" elif [[ "$single" = equal ]]; then - compadd "$expl[@]" -QqS= - "${PREFIX}${SUFFIX}" + _all_labels options expl option \ + compadd -QqS= - "${PREFIX}${SUFFIX}" else tmp1=( "$next[@]" "$direct[@]" "$odirect[@]" "$equal[@]" ) tmp3=( "${(M@)tmp1:#[-+]?[^:]*}" ) diff --git a/Completion/Base/_first b/Completion/Base/_first index 4f10cbb8f..4b565fca4 100644 --- a/Completion/Base/_first +++ b/Completion/Base/_first @@ -33,7 +33,7 @@ # opt=-V # fi # if _wanted "$opt" history-words expl "history ($n)" \ -# compadd "$expl[@]" -Q - \ +# compadd -Q - \ # "${(@)${(@)historywords:#[\$'\"]*}[1,i*10]}"; then # # We have found at least one matching word, so we switch # # on menu-completion and make sure that no other diff --git a/Completion/Builtins/_hash b/Completion/Builtins/_hash index c577fc4d7..0bda9df44 100644 --- a/Completion/Builtins/_hash +++ b/Completion/Builtins/_hash @@ -10,7 +10,7 @@ if [[ "$words[2]" = -*d* ]]; then compadd -q -S '=' - "${(@k)nameddirs}" fi elif compset -P 1 '*='; then - _wanted -C value values expl 'executable file' _files "$expl[@]" -g '*(-*)' + _wanted -C value values expl 'executable file' _files -g '*(-*)' else _wanted -C name commands expl command compadd -q -S '=' - "${(@k)commands}" fi diff --git a/Completion/Core/_expand b/Completion/Core/_expand index 293ad3649..47253a094 100644 --- a/Completion/Core/_expand +++ b/Completion/Core/_expand @@ -94,10 +94,8 @@ if [[ -z "$compstate[insert]" ]] ;then else _tags all-expansions expansions original - if _requested all-expansions; then - _description all-expansions expl 'all expansions' - compadd "$expl[@]" -UQ -qS "$suf" - "$exp" - fi + _requested all-expansions expl 'all expansions' && + compadd "$expl[@]" -UQ -qS "$suf" - "$exp" if [[ $#exp -gt 1 ]] && _requested expansions; then local i normal dir diff --git a/Completion/User/_gprof b/Completion/User/_gprof index 659e921e8..f261ff700 100644 --- a/Completion/User/_gprof +++ b/Completion/User/_gprof @@ -49,7 +49,7 @@ if [[ -n "$state" ]]; then expl=function fi _wanted functions expl "$expl" \ - compadd "$expl[@]" -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0 + compadd -M 'r:|_=* r:|=*' - "$_gprof_funcs[@]" && ret=0 else return 1 fi diff --git a/Completion/User/_mount b/Completion/User/_mount index 418b7974f..0d8d0996f 100644 --- a/Completion/User/_mount +++ b/Completion/User/_mount @@ -540,7 +540,7 @@ fstype) compset -P '*,' _wanted types expl 'file system type' \ - compadd "$expl[@]" -qS, -M 'L:|no=' - "$fss[@]" && ret=0 + compadd -qS, -M 'L:|no=' - "$fss[@]" && ret=0 ;; fsopt) _tags options || return 1 diff --git a/Completion/User/_socket b/Completion/User/_socket index af9c8ab0a..788113c28 100644 --- a/Completion/User/_socket +++ b/Completion/User/_socket @@ -11,8 +11,7 @@ typeset -A opt_args [[ $CURRENT -eq 2 ]] && { ! zstyle -T ":completion:${curcontext}:options" prefix-needed || [[ "$PREFIX" = -* ]] } && - _wanted options expl option \ - compadd -M 'r:|[_-]=* r:|=*' "$expl[@]" - -version + _wanted options expl option compadd - -version _arguments -C -s \ '-b[background]' \ diff --git a/Completion/User/_urls b/Completion/User/_urls index f9c3284f7..f335b16aa 100644 --- a/Completion/User/_urls +++ b/Completion/User/_urls @@ -104,7 +104,7 @@ case "$scheme" in while _next_label files expl 'bookmark'; do _path_files -W "$urls_path/$scheme" "$expl[@]" -S '' -g '*(^/)' && ret=0 - _path_files -W "$urls_path/$scheme" -S/ -r '/' -/ && ret=0 + _path_files -W "$urls_path/$scheme" "$expl[@]" -S/ -r '/' -/ && ret=0 done (( ret )) || return 0 done -- cgit 1.4.1