zsh-workers
 help / color / mirror / code / Atom feed
* [PATCH] _signals: Don't complete SIGEXIT from _kill.
@ 2016-06-02 13:29 Daniel Shahaf
  0 siblings, 0 replies; only message in thread
From: Daniel Shahaf @ 2016-06-02 13:29 UTC (permalink / raw)
  To: zsh-workers

---
 Completion/Unix/Type/_signals | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/Completion/Unix/Type/_signals b/Completion/Unix/Type/_signals
index 104efd4..df9a2f3 100644
--- a/Completion/Unix/Type/_signals
+++ b/Completion/Unix/Type/_signals
@@ -8,12 +8,15 @@
 #
 # A `-' or `--' as the first argument is ignored.
 
-local expl last minus pre sigs
+local expl minus pre sigs
+local first last # keep these as strings for -z/-n tests
 
 zparseopts -D -K -E 'p=minus' 'a=last' 's=pre'
 if [[ -z "$last" ]]; then
+  first=2
   last=-3
 else
+  first=1
   last=-1
 fi
 [[ -n "$minus" ]] && minus='-'
@@ -26,20 +29,20 @@ if [[ -z "$minus" ]] ||
   local disp tmp
 
   if zstyle -t ":completion:${curcontext}:signals" prefix-hidden; then
-    tmp=( "${(@)signals[1,last]}" )
+    tmp=( "${(@)signals[first,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]}" )
+    sigs=( "${minus}SIG${(@)^signals[first,last]}" )
+    (( $#disp )) && tmp=( "$tmp[@]" "${(@)signals[first,last]}" )
   else
     sigs=()
   fi
 
   _wanted signals expl signal \
       compadd "$@" "$disp[@]" -M 'm:{a-z}={A-Z}' - \
-              "${minus}${(@)^signals[1,last]}" "$sigs[@]"
+              "${minus}${(@)^signals[first,last]}" "$sigs[@]"
 fi

In my .zshrc I just define:
    Signals=( ${signals[2,-3]} )
to have an array mapping signal number to signal name.


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2016-06-02 13:35 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-06-02 13:29 [PATCH] _signals: Don't complete SIGEXIT from _kill Daniel Shahaf

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).