summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--Completion/Base/_value8
2 files changed, 12 insertions, 1 deletions
diff --git a/ChangeLog b/ChangeLog
index cd4103570..562f3905a 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,8 @@
+2000-07-26  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* users/3337: Completion/Base/_value: allow _value:<assoc> functions to
+ 	override completion for all keys of an assoc
+	
 2000-07-24  Oliver Kiddle  <opk@zsh.org>
 
 	* 12356: Completion/User/_mh: use mhpath and mhparam instead of
diff --git a/Completion/Base/_value b/Completion/Base/_value
index 402bab236..15218eb60 100644
--- a/Completion/Base/_value
+++ b/Completion/Base/_value
@@ -2,10 +2,16 @@
 
 _value () {
   # You can customize completion for different parameters by writing a
-  # function `_value:<name>'.
+  # function `_value:<name>', where <name> is the name of the parameter.
+  # When completing values of elements of associative arrays, we first
+  # search for a function `_value:<assoc>-<key>' and then for 
+  # `_value:<assoc>', so it's simple to define different functions
+  # for different keys or one function for a whole association.
 
   if (( $+functions[_value:$compstate[parameter]] )); then
     "_value:$compstate[parameter]" "$@"
+  elif (( $+functions[_value:${compstate[parameter]%%-*}] )); then
+    "_value:${compstate[parameter]%%-*}" "$@"
   elif [[ "$compstate[parameter]" != *-* &&
           "${(Pt)${compstate[parameter]}}" = assoc* ]]; then
     if (( CURRENT & 1 )); then