about summary refs log tree commit diff
path: root/Completion/Core/_style
diff options
context:
space:
mode:
authorTanaka Akira <akr@users.sourceforge.net>1999-11-12 15:28:24 +0000
committerTanaka Akira <akr@users.sourceforge.net>1999-11-12 15:28:24 +0000
commite6282df1155e8d9b08b2e518a452c1997973f1ce (patch)
treeb0c8ed7e8512cc4397ae7df6d138ea66147565b3 /Completion/Core/_style
parent167b0ae3b98938f75287dcf2e112d41a03532c5f (diff)
downloadzsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.gz
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.tar.xz
zsh-e6282df1155e8d9b08b2e518a452c1997973f1ce.zip
manual/8630
Diffstat (limited to 'Completion/Core/_style')
-rw-r--r--Completion/Core/_style55
1 files changed, 30 insertions, 25 deletions
diff --git a/Completion/Core/_style b/Completion/Core/_style
index b0cbd7b00..a3b54686f 100644
--- a/Completion/Core/_style
+++ b/Completion/Core/_style
@@ -1,45 +1,50 @@
 #autoload
 
-local tags get i
+local all get val i
+
+# Should we return the value?
 
 if [[ "$1" = -g ]]; then
   get=yes
   shift
 fi
 
-if (( ${+_cur_tags[${funcstack[2,-1]}]} )); then
-  tags="${_cur_tags[${funcstack[2,-1]}]}"
-else
-  tags="${_cur_tags[${funcstack[3,-1]}]}"
-fi
+# Get all styles defined for this context.
 
-if [[ "$tags" = *:${1}\[*\]:* ]]; then
+all=()
+for i in "${(s.:.)_cur_contexts}"; do
+  all=("$all[@]" "${(@)_compstyles[(K)${i},${1}]}" )
+done
+all=":${(j.:.)${(@o)all:#}##??}:"
 
-  tags="${${tags#*:${1}\[}%%\]*}"
+if [[ "$all" = *:${2}[:\=]* ]]; then
 
-  if [[ $# -eq 2 ]]; then
-    if [[ -n "$get" ]]; then
-      eval "${2}=\"$tags\""
-      return 0
-    fi
+  # We have a definition for the style.
 
-    [[ "$tags" = (|*,)${2}(|,*) ]]
-    return
-  fi
+  if [[ $# -eq 3 ]]; then
+    if [[ -n "$get" ]]; then
 
-  [[ "$tags" = (|*,)${2}(|(\=|,)*) ]] || return 1
+      # We have to return the value.
 
-  if [[ -n "$get" ]]; then
-    if [[ "$tags" = (|*,)${2}\=* ]]; then
-      eval "${3}=\"${${tags#(|*,)${2}\=}%%,*}\""
+      if [[ "$all" = *,${2}\=* ]]; then
+        eval "${3}=\"${${all#*:${2}\=}%%:*}\""
+      else
+        eval "${3}=''"
+      fi
     else
-      eval "${3}=''"
+
+      # We have to test the value.
+
+      if [[ "$all" = *:${2}\=* ]]; then
+        [[ "${${all#*:${2}\=}%%:*}" = ${~3} ]]
+      else
+        [[ '' -eq ${~3} ]]
+      fi
+
+      return
     fi
-    return 0
   fi
-
-  [[ "$tags" = (|*,)${2}\=(|[^,]#,)${3}(|,*) ]] 
-  return
+  return 0
 fi
 
 return 1