about summary refs log tree commit diff
path: root/Completion/Commands
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>2000-01-04 08:43:19 +0000
committerTanaka Akira <akr@users.sourceforge.net>2000-01-04 08:43:19 +0000
commite0d57c198cd4d4467fc272dc2d2361d765a27db1 (patch)
tree338c2ab34c14e326a009abb0365cd1d725b5af2d /Completion/Commands
parent61f7e388c400ee49c01ff4a36f9068341da2154d (diff)
downloadzsh-e0d57c198cd4d4467fc272dc2d2361d765a27db1.tar.gz
zsh-e0d57c198cd4d4467fc272dc2d2361d765a27db1.tar.xz
zsh-e0d57c198cd4d4467fc272dc2d2361d765a27db1.zip
zsh-users/2826
Diffstat (limited to 'Completion/Commands')
-rw-r--r--Completion/Commands/_complete_help25
1 files changed, 14 insertions, 11 deletions
diff --git a/Completion/Commands/_complete_help b/Completion/Commands/_complete_help
index 446fb2a90..b172e76db 100644
--- a/Completion/Commands/_complete_help
+++ b/Completion/Commands/_complete_help
@@ -1,11 +1,8 @@
 #compdef -k complete-word \C-xh
 
 _complete_help() {
-  local _sort_tags=_help_sort_tags text i
-  typeset -A help_tags
-  typeset -U help_contexts
-
-  help_contexts=()
+  local _sort_tags=_help_sort_tags text i j
+  typeset -A help_funcs help_tags
 
   compadd() { return 1 }
 
@@ -13,9 +10,12 @@ _complete_help() {
 
   unfunction compadd
 
-  for i in "$help_contexts[@]"; do
+  for i in "${(@k)help_funcs}"; do
     text="${text}
-tags in context \`${i}': ${help_tags[$i]}"
+tags in context ${i}"
+    for j in "${(@s.:.)help_funcs[$i][2,-1]}"; do
+      text="${text}${help_tags[${i}${j}]}	(${j})"
+    done
   done
 
   compstate[list]='list force'
@@ -25,10 +25,13 @@ tags in context \`${i}': ${help_tags[$i]}"
 }
 
 _help_sort_tags() {
-  help_contexts=( "$help_contexts[@]" "$curcontext" )
-  help_tags[$curcontext]="${help_tags[$curcontext]}
-    ${argv}"
-  comptry "$@"
+  local f="${${${funcstack[3,(i)_(main_complete|complete|approximate|normal)]}% *}#_(wanted|requested) }"
+  if [[ "$help_funcs[$curcontext]" != *${f}* ]]; then
+    help_funcs[$curcontext]="${help_funcs[$curcontext]}:${f}"
+    help_tags[${curcontext}${f}]="${help_tags[$curcontext]}
+      ${argv}"
+    comptry "$@"
+  fi
 }
 
 _complete_help "$@"