about summary refs log tree commit diff
path: root/Completion/Unix
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 /Completion/Unix
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)
Diffstat (limited to 'Completion/Unix')
-rw-r--r--Completion/Unix/Type/_signals16
1 files changed, 12 insertions, 4 deletions
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