From a267832ddf4150652fde3936858841bb2edbd9ae Mon Sep 17 00:00:00 2001 From: Oliver Kiddle Date: Wed, 25 Jun 2003 09:03:04 +0000 Subject: 18631: returning too early breaks prefix-needed style set to false --- Completion/Zsh/Command/_compdef | 14 ++++++++------ Completion/Zsh/Command/_hash | 14 ++++++++------ Completion/Zsh/Command/_which | 14 ++++++++------ 3 files changed, 24 insertions(+), 18 deletions(-) (limited to 'Completion/Zsh') diff --git a/Completion/Zsh/Command/_compdef b/Completion/Zsh/Command/_compdef index aad1358b9..7a64da835 100644 --- a/Completion/Zsh/Command/_compdef +++ b/Completion/Zsh/Command/_compdef @@ -32,7 +32,7 @@ _arguments -C -s -S \ '*-P[completion for command matching pattern]' \ ':completion function:->cfun' \ '*:commands:->com' \ - "$args2[@]" && return 0 + "$args2[@]" && ret=0 if [[ $state = multi ]]; then case $(( CURRENT % 3 )) in @@ -50,20 +50,20 @@ case $state in if (( pat && pat > normal )); then _message -e patterns 'pattern' else - _command_names + _command_names && ret=0 fi ;; ccom) - _wanted commands expl 'completed command' compadd -k _comps + _wanted commands expl 'completed command' compadd -k _comps && ret=0 ;; cfun) list=( ${^fpath:/.}/_(|*[^~])(:t) ) if zstyle -T ":completion:${curcontext}:functions" prefix-hidden; then disp=( ${list[@]#_} ) _wanted functions expl 'completion function' \ - compadd -d disp -a list + compadd -d disp -a list && ret=0 else - _wanted functions expl 'completion function' compadd -a list + _wanted functions expl 'completion function' compadd -a list && ret=0 fi ;; style) @@ -71,6 +71,8 @@ case $state in compadd -M 'r:|-=* r:|=*' \ complete-word delete-char-or-list expand-or-complete \ expand-or-complete-prefix list-choices menu-complete \ - menu-expand-or-complete reverse-menu-complete + menu-expand-or-complete reverse-menu-complete && ret=0 ;; esac + +return ret diff --git a/Completion/Zsh/Command/_hash b/Completion/Zsh/Command/_hash index a065615ef..80c136118 100644 --- a/Completion/Zsh/Command/_hash +++ b/Completion/Zsh/Command/_hash @@ -1,6 +1,6 @@ #compdef hash rehash -local state line expl common_args curcontext="$curcontext" +local state line expl common_args curcontext="$curcontext" ret=1 typeset -A opt_args common_args=( \ @@ -15,7 +15,7 @@ case ${service} in '(-f -r -m)-v[list entries as they are added]' \ '(-f -r -v)-L[list in the form of calls to hash]' \ "${common_args[@]}" \ - '(-d -f -r -m -v -L)*:hash:->hashval' && return 0 + '(-d -f -r -m -v -L)*:hash:->hashval' && ret=0 ;; rehash) _arguments -C -s ${common_args[@]} && return 0 @@ -25,14 +25,16 @@ esac if [[ $state = hashval ]]; then if (( $+opt_args[-d] )); then if compset -P 1 '*='; then - _wanted -C value files expl directories _path_files -/ + _wanted -C value files expl directories _path_files -/ && ret=0 else _wanted -C name named-directories expl 'named directory' \ - compadd -q -S '=' -k nameddirs + compadd -q -S '=' -k nameddirs && ret=0 fi elif compset -P 1 '*='; then - _wanted -C value values expl 'executable file' _files -g '*(-*)' + _wanted -C value values expl 'executable file' _files -g '*(-*)' && ret=0 else - _wanted -C name commands expl command compadd -q -S '=' -k commands + _wanted -C name commands expl command compadd -q -S '=' -k commands && ret=0 fi fi + +return ret diff --git a/Completion/Zsh/Command/_which b/Completion/Zsh/Command/_which index 279475451..2b89112bc 100644 --- a/Completion/Zsh/Command/_which +++ b/Completion/Zsh/Command/_which @@ -1,6 +1,6 @@ #compdef which whence where type -local farg aarg cargs args state line curcontext="$curcontext" +local farg aarg cargs args state line curcontext="$curcontext" ret=1 cargs=( \ '(-v -c)-w[print command type]' \ @@ -16,11 +16,11 @@ case ${service} in _arguments -C -s -A "-*" -S \ '(-c -w)-v[verbose output]' \ '(-v -w)-c[csh-like output]' \ - "${cargs[@]}" "$farg" "$aarg" && return 0 + "${cargs[@]}" "$farg" "$aarg" && ret=0 ;; - where) _arguments -C -s -A "-*" -S "${cargs[@]}" && return 0;; - which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && return 0;; - type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && return 0;; + where) _arguments -C -s -A "-*" -S "${cargs[@]}" && ret=0;; + which) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" && ret=0;; + type) _arguments -C -s -A "-*" -S "${cargs[@]}" "$aarg" "$farg" && ret=0;; esac if [[ "$state" = command ]]; then @@ -32,6 +32,8 @@ if [[ "$state" = command ]]; then 'builtins:builtin command:compadd -k builtins' \ 'functions:shell function:compadd -k functions' \ 'aliases:alias:compadd -k aliases' \ - 'reserved-words:reserved word:compadd -k reswords' + 'reserved-words:reserved word:compadd -k reswords' && ret=0 fi + +return ret -- cgit 1.4.1