summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-07 14:38:13 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2002-01-07 14:38:13 +0000
commit90bbd87734053303751d401a807be8a7fe3b9176 (patch)
tree3ea728b70c4fd811c83659de35278677b7c31ca7
parentad41ecec2b030446aacf8337e67da81ab189caaa (diff)
downloadzsh-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)
-rw-r--r--ChangeLog8
-rw-r--r--Completion/Base/Completer/_approximate4
-rw-r--r--Completion/Unix/Type/_signals16
-rw-r--r--Completion/Zsh/Command/_kill6
-rw-r--r--Doc/Zsh/builtins.yo3
5 files changed, 27 insertions, 10 deletions
diff --git a/ChangeLog b/ChangeLog
index e8c39916c..ee9e110a1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2002-01-07  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* 16406: Completion/Base/Completer/_approximate,
+	Completion/Unix/Type/_signals, Completion/X/Command/_netscape,
+	Completion/Zsh/Command/_kill, Doc/Zsh/builtins.yo: fixes for
+	completion of signal names with SIG prefix and for completing
+	command names instead of pids
+
 2002-01-05  Bart Schaefer  <schaefer@zsh.org>
 
 	* 16400, 16401: Src/subst.c: preserve empty words that result from
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
diff --git a/Doc/Zsh/builtins.yo b/Doc/Zsh/builtins.yo
index 463bfcf53..15b8ba23e 100644
--- a/Doc/Zsh/builtins.yo
+++ b/Doc/Zsh/builtins.yo
@@ -539,7 +539,8 @@ tt(-)var(sig) ] var(job) ...)
 item(tt(kill) tt(-l) [ var(sig) ... ])(
 Sends either tt(SIGTERM) or the specified signal to the given
 jobs or processes.
-Signals are given by number or by names, without the `tt(SIG)' prefix.
+Signals are given by number or by names, with or without the `tt(SIG)'
+prefix.
 If the signal being sent is not `tt(KILL)' or `tt(CONT)', then the job
 will be sent a `tt(CONT)' signal if it is stopped.
 The argument var(job) can be the process ID of a job