about summary refs log tree commit diff
path: root/Completion/Core/compinit
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-12-14 10:14:51 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-12-14 10:14:51 +0000
commit259b64d0d75fc6c014609fc790f6ce671206f0b5 (patch)
treef06b1ffedc79cc3bf0a17dd3f91df4bc339a1e96 /Completion/Core/compinit
parent8cb0bdc6a089e3ca58af81dffe4695b45a4cc04e (diff)
downloadzsh-259b64d0d75fc6c014609fc790f6ce671206f0b5.tar.gz
zsh-259b64d0d75fc6c014609fc790f6ce671206f0b5.tar.xz
zsh-259b64d0d75fc6c014609fc790f6ce671206f0b5.zip
zsh-workers/9035
Diffstat (limited to 'Completion/Core/compinit')
-rw-r--r--Completion/Core/compinit27
1 files changed, 7 insertions, 20 deletions
diff --git a/Completion/Core/compinit b/Completion/Core/compinit
index 57c7a97e2..59aa137b1 100644
--- a/Completion/Core/compinit
+++ b/Completion/Core/compinit
@@ -79,12 +79,10 @@ while [[ $# -gt 0 && $1 = -[dDf] ]]; do
 done
 
 # The associative array containing the definitions for the commands.
-# Definitions for patterns will be stored in the normal arrays `_patcomps'
+# Definitions for patterns will be stored in the associations `_patcomps'
 # and `_postpatcomps'.
 
-typeset -gA _comps
-_patcomps=()
-_postpatcomps=()
+typeset -gA _comps _patcomps _postpatcomps
 
 # The associative array use to report information about the last
 # cmpletion to the outside.
@@ -212,17 +210,14 @@ compdef() {
         echo "$0: only one pattern allowed"
 	return 1
       fi
-      # Patterns are stored in strings like `c* foo', with a space
-      # between the pattern and the function name.
-
-      _patcomps=("$_patcomps[@]" "$1 $func")
+      _patcomps[$1]="$func"
       ;;
     postpattern)
       if [[ $# -gt 1 ]]; then
         echo "$0: only one pattern allowed"
 	return 1
       fi
-      _postpatcomps=("$_postpatcomps[@]" "$1 $func")
+      _postpatcomps[$1]="$func"
       ;;
     widgetkey)
       while [[ -n $1 ]]; do
@@ -283,15 +278,10 @@ compdef() {
     # Handle the `-d' option, deleting.
     case "$type" in
     pattern)
-      # Note the space.
-      for i; do
-        _patcomps=("${(@)_patcomps:#$i *}")
-      done
+      unset "_patcomps[$^@]"
       ;;
     postpattern)
-      for i; do
-        _postpatcomps=("${(@)_postpatcomps:#$i *}")
-      done
+      unset "_postpatcomps[$^@]"
       ;;
     key)
       # Oops, cannot do that yet.
@@ -300,10 +290,7 @@ compdef() {
       return 1
       ;;
     *)
-      # Deleting definitons for command is even simpler.
-      for i; do
-        unset "_comps[$i]"
-      done
+      unset "_comps[$^@]"
     esac
   fi
 }