about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Unix/Type/_pids43
2 files changed, 29 insertions, 19 deletions
diff --git a/ChangeLog b/ChangeLog
index 5378071fb..a03c646dd 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2014-08-13  Oliver Kiddle  <opk@zsh.org>
+
+	* 32893: Completion/Unix/Type/_pids: move use of _call_program
+	inside the _tags loop to allow processes to be separated
+
 2014-08-12  Peter Stephenson  <p.w.stephenson@ntlworld.com>
 
 	* Config/version.mk: update to 5.0.5-dev-2.
diff --git a/Completion/Unix/Type/_pids b/Completion/Unix/Type/_pids
index 3f99dfdf0..3c6a76561 100644
--- a/Completion/Unix/Type/_pids
+++ b/Completion/Unix/Type/_pids
@@ -20,25 +20,30 @@ else
   nm="$compstate[nmatches]"
 fi
 
-out=( "${(@f)$(_call_program processes ps 2>/dev/null)}" )
-desc="$out[1]"
-out=( "${(@M)out[2,-1]:#${~match}}" )
-
-if [[ "$desc" = (#i)(|*[[:blank:]])pid(|[[:blank:]]*) ]]; then
-  pids=( "${(@)${(@M)out#${(l.${#desc[1,(r)(#i)[[:blank:]]pid]}..?.)~:-}[^[:blank:]]#}##*[[:blank:]]}" )
-else
-  pids=( "${(@)${(@M)out##[^0-9]#[0-9]#}##*[[:blank:]]}" )
-fi
-
-if zstyle -T ":completion:${curcontext}:processes" verbose; then
-  list=( "${(@Mr:COLUMNS-1:)out}" )
-  desc=(-ld list)
-else
-  desc=()
-fi
-
-_wanted -V processes expl 'process ID' \
-    compadd "$@" "$desc[@]" "$all[@]" -a - pids && ret=0
+while _tags; do
+  if _requested processes; then
+    while _next_label processes expl 'process ID'; do
+      out=( "${(@f)$(_call_program $curtag ps 2>/dev/null)}" )
+      desc="$out[1]"
+      out=( "${(@M)out[2,-1]:#${~match}}" )
+
+      if [[ "$desc" = (#i)(|*[[:blank:]])pid(|[[:blank:]]*) ]]; then
+	pids=( "${(@)${(@M)out#${(l.${#desc[1,(r)(#i)[[:blank:]]pid]}..?.)~:-}[^[:blank:]]#}##*[[:blank:]]}" )
+      else
+	pids=( "${(@)${(@M)out##[^0-9]#[0-9]#}##*[[:blank:]]}" )
+      fi
+
+      if zstyle -T ":completion:${curcontext}:$curtag" verbose; then
+	list=( "${(@Mr:COLUMNS-1:)out}" )
+	desc=(-ld list)
+      else
+	desc=()
+      fi
+      compadd "$@" "$expl[@]" "$desc[@]" "$all[@]" -a pids && ret=0
+    done
+  fi
+  (( ret )) || break
+done
 
 if [[ -n "$all" ]]; then
   zstyle -s ":completion:${curcontext}:processes" insert-ids out || out=menu