about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog3
-rw-r--r--Completion/Unix/Command/_pgrep7
2 files changed, 8 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog
index 1f559c22e..648f030e0 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,8 @@
 2021-06-14  dana  <dana@dana.is>
 
+	* 48920: Completion/Unix/Command/_pgrep: Address issues related to
+	-f completion
+
 	* 48920: Completion/Unix/Command/_pgrep: Clarify -x description
 
 2021-06-13  Bart Schaefer  <schaefer@zsh.org>
diff --git a/Completion/Unix/Command/_pgrep b/Completion/Unix/Command/_pgrep
index 443acf3c8..38b1aebd8 100644
--- a/Completion/Unix/Command/_pgrep
+++ b/Completion/Unix/Command/_pgrep
@@ -170,10 +170,13 @@ case $state in
       ispat+="full "
     fi
     if (( ${+opt_args[-f]} )); then
+      local -a opts=( -lf )
+      [[ $OSTYPE == linux* ]] && opts=( -a )
       local -a matches=( ${(f)"$(
-              _call_program process-args pgrep -lf ${${:-$PREFIX$SUFFIX}:-.\*}
+              _call_program process-args pgrep ${(@q)opts} -- \
+                  ${(q)${${:-$PREFIX$SUFFIX}:-.\*}}
           )"} )
-      local -a displ=( "${${matches[@]//':'/'\:'}[@]/ /:}" )
+      local -a displ=( "${${matches[@]//:/\:}[@]/ /:}" )
       matches=( "${matches[@]##<-> }" )
 
       local desc=$ispat'process command line'