about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorOliver Kiddle <opk@zsh.org>2016-09-16 00:05:10 +0200
committerOliver Kiddle <opk@zsh.org>2016-09-16 00:05:10 +0200
commitb870ff85a0bcda9d38a734aa86bb6aee3d76983e (patch)
tree0c0dfd095a058bc8814dc4ed31dfcabd90bc18a5 /Completion/Base
parentfbafc5b509e311efee064bbd12396a2e207f3393 (diff)
downloadzsh-b870ff85a0bcda9d38a734aa86bb6aee3d76983e.tar.gz
zsh-b870ff85a0bcda9d38a734aa86bb6aee3d76983e.tar.xz
zsh-b870ff85a0bcda9d38a734aa86bb6aee3d76983e.zip
39333: include name of command used to gain priviliges in context for command and gain-priviliges styles
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Utility/_call_program9
1 files changed, 6 insertions, 3 deletions
diff --git a/Completion/Base/Utility/_call_program b/Completion/Base/Utility/_call_program
index 95c761e65..9a44f2d8e 100644
--- a/Completion/Base/Utility/_call_program
+++ b/Completion/Base/Utility/_call_program
@@ -1,12 +1,15 @@
 #autoload +X
 
-local tmp err_fd=-1
+local curcontext="${curcontext}" tmp err_fd=-1
 local -a prefix
 
 if [[ "$1" = -p ]]; then
   shift
-  zstyle -t ":completion:${curcontext}:${1}" gain-privileges &&
-      prefix=( $_comp_priv_prefix )
+  if (( $#_comp_priv_prefix )); then
+    curcontext="${curcontext%:*}/${${(@M)_comp_priv_prefix:#^*[^\\]=*}[1]}:"
+    zstyle -t ":completion:${curcontext}:${1}" gain-privileges &&
+	prefix=( $_comp_priv_prefix )
+  fi
 fi
 
 if (( ${debug_fd:--1} > 2 )) || [[ ! -t 2 ]]