diff options
author | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-01-07 14:38:13 +0000 |
---|---|---|
committer | Sven Wischnowsky <wischnow@users.sourceforge.net> | 2002-01-07 14:38:13 +0000 |
commit | 90bbd87734053303751d401a807be8a7fe3b9176 (patch) | |
tree | 3ea728b70c4fd811c83659de35278677b7c31ca7 /Completion | |
parent | ad41ecec2b030446aacf8337e67da81ab189caaa (diff) | |
download | zsh-90bbd87734053303751d401a807be8a7fe3b9176.tar.gz zsh-90bbd87734053303751d401a807be8a7fe3b9176.tar.xz zsh-90bbd87734053303751d401a807be8a7fe3b9176.zip |
fixes for completion of signal names with SIG prefix and for completing command names instead of pids (16406)
Diffstat (limited to 'Completion')
-rw-r--r-- | Completion/Base/Completer/_approximate | 4 | ||||
-rw-r--r-- | Completion/Unix/Type/_signals | 16 | ||||
-rw-r--r-- | Completion/Zsh/Command/_kill | 6 |
3 files changed, 17 insertions, 9 deletions
diff --git a/Completion/Base/Completer/_approximate b/Completion/Base/Completer/_approximate index 39518803e..b0d8c43c2 100644 --- a/Completion/Base/Completer/_approximate +++ b/Completion/Base/Completer/_approximate @@ -60,8 +60,8 @@ if (( ! $+functions[compadd] )); then PREFIX="(#a${_comp_correct})$PREFIX" fi - (( $_correct_group && $argv[(I)-*[JV]] )) && - _correct_expl[_correct_group]=${argv[(R)-*[JV]]} + (( $_correct_group && ${${argv[1,(r)-(|-)]}[(I)-*[JV]]} )) && + _correct_expl[_correct_group]=${argv[1,(r)-(-|)][(R)-*[JV]]} builtin compadd "$_correct_expl[@]" "$@" } diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals index 32cb8285c..5723f4f9c 100644 --- a/Completion/Unix/Type/_signals +++ b/Completion/Unix/Type/_signals @@ -4,12 +4,13 @@ # # -a use all signals (even the pseudo-signals) # -p needs a `-' prefix +# -s SIG prefix allowed # # A `-' or `--' as the first argument is ignored. -local expl last minus +local expl last minus pre sigs -zparseopts -D -K -E 'p=minus' 'a=last' +zparseopts -D -K -E 'p=minus' 'a=last' 's=pre' if [[ -z "$last" ]]; then last=-1 else @@ -24,14 +25,21 @@ if [[ -z "$minus" ]] || [[ -prefix -* ]]; then local disp tmp - [[ -prefix ${minus}SIG* ]] && minus+=SIG if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then tmp=( "${(@)signals[1,last]}" ) disp=(-d tmp) else disp=() fi + + if [[ -n "$pre" && $PREFIX = ${minus}S* ]]; then + sigs=( "${minus}SIG${(@)^signals[1,last]}" ) + (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[1,last]}" ) + else + sigs=() + fi + _wanted signals expl signal \ compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \ - "${minus}${(@)^signals[1,last]}" + "${minus}${(@)^signals[1,last]}" "$sigs[@]" fi diff --git a/Completion/Zsh/Command/_kill b/Completion/Zsh/Command/_kill index 8887be5fc..5e52a99de 100644 --- a/Completion/Zsh/Command/_kill +++ b/Completion/Zsh/Command/_kill @@ -4,12 +4,12 @@ local curcontext="$curcontext" line state ret=1 _arguments -C \ '(-s -l 1)-n[specify signal number]:signal number' \ - '(-n -l 1)-s[specify signal name]:signal:_signals' \ + '(-n -l 1)-s[specify signal name]:signal:_signals -s' \ '(-n -s)-l[list signal names or numbers of specified signals]:*:signal:_signals' \ - '(-n -s -l)1::signal:_signals -p' \ + '(-n -s -l)1::signal:_signals -p -s' \ '*:processes:->processes' && ret=0 -if [[ -n "$state" && -prefix [%0-9]# ]]; then +if [[ -n "$state" ]]; then _alternative \ 'processes:: _pids' \ 'jobs:: _jobs -t' && ret=0 |