about summary refs log tree commit diff
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-19 08:47:43 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2000-06-19 08:47:43 +0000
commit4299878002e6caddc8f69b7e290f871934470ce9 (patch)
treeab6d11c5cced8e0863f3e618f8d53c4966031df1
parentbfaf5478a355ecbbad0c46e6cb0f8f1555e8e3dc (diff)
downloadzsh-4299878002e6caddc8f69b7e290f871934470ce9.tar.gz
zsh-4299878002e6caddc8f69b7e290f871934470ce9.tar.xz
zsh-4299878002e6caddc8f69b7e290f871934470ce9.zip
restore ZLS_COLORS when possible; better group-name handling in ZLS_COLORS (3188)
-rw-r--r--ChangeLog6
-rw-r--r--Completion/Core/_description7
-rw-r--r--Completion/Core/_setup13
-rw-r--r--Doc/Zsh/compsys.yo11
4 files changed, 30 insertions, 7 deletions
diff --git a/ChangeLog b/ChangeLog
index 08a1838b0..26d6a12f1 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2000-06-19  Sven Wischnowsky  <wischnow@zsh.org>
+
+	* users/3188: Completion/Core/_description, Completion/Core/_setup,
+ 	Doc/Zsh/compsys.yo: restore ZLS_COLORS when possible; better
+ 	group-name handling in ZLS_COLORS
+	
 2000-06-17  Clint Adams  <schizo@debian.org>
 
 	* 11966: Completion/Core/_main_complete: use double brackets
diff --git a/Completion/Core/_description b/Completion/Core/_description
index 700f39575..b1b98741c 100644
--- a/Completion/Core/_description
+++ b/Completion/Core/_description
@@ -11,7 +11,10 @@ fi
 
 _lastdescr=( "$_lastdescr[@]" "$3" )
 
-_setup "$1"
+zstyle -s ":completion:${curcontext}:$1" group-name gname &&
+    [[ -z "$gname" ]] && gname="$1"
+
+_setup "$1" "${gname:--default-}"
 
 name="$2"
 
@@ -23,8 +26,6 @@ if zstyle -s ":completion:${curcontext}:$1" hidden hidden &&
   [[ "$hidden" = all ]] && format=''
   opts=(-n)
 fi
-zstyle -s ":completion:${curcontext}:$1" group-name gname &&
-    [[ -z "$gname" ]] && gname="$1"
 zstyle -s ":completion:${curcontext}:$1" matcher match &&
     opts=($opts -M "$match")
 [[ -n "$_matcher" ]] && opts=($opts -M "$_matcher")
diff --git a/Completion/Core/_setup b/Completion/Core/_setup
index 6bc36e3ef..50e3dbfd8 100644
--- a/Completion/Core/_setup
+++ b/Completion/Core/_setup
@@ -2,12 +2,21 @@
 
 local val nm="$compstate[nmatches]"
 
+[[ $# -eq 1 ]] && 2="$1"
+
 if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
   zmodload -i zsh/complist
   if [[ "$1" = default ]]; then
     ZLS_COLORS="${(j.:.)${(@)val:gs/:/\\\:}}"
   else
-    eval "ZLS_COLORS=\"(${1})\${(j.:(${1}).)\${(@)val:gs/:/\\\:}}:\${ZLS_COLORS}\""
+    local simple grouped
+
+    simple=( "(${2})${(@)^val:#\(*\)*}" )
+    grouped=( "${(M@)val:#\(*\)*}" )
+    simple="${(j.:.)simple}:"
+    grouped="${(j.:.)grouped}:"
+    [[ "$ZLS_COLORS" != *${simple}*  ]] && ZLS_COLORS="${simple}$ZLS_COLORS"
+    [[ "$ZLS_COLORS" != *${grouped}* ]] && ZLS_COLORS="${grouped}$ZLS_COLORS"
   fi
 
 # Here is the problem mentioned in _main_complete.
@@ -16,6 +25,8 @@ if zstyle -a ":completion:${curcontext}:$1" list-colors val; then
 #   zmodload -i zsh/complist
 #   ZLS_COLORS="$ZLS_COLORS$ZLS_COLOURS"
 
+elif [[ "$1" = default ]]; then
+  ZLS_COLORS=
 fi
 
 if zstyle -t ":completion:${curcontext}:$1" list-packed; then
diff --git a/Doc/Zsh/compsys.yo b/Doc/Zsh/compsys.yo
index 0c6f218e9..82a9fd5fe 100644
--- a/Doc/Zsh/compsys.yo
+++ b/Doc/Zsh/compsys.yo
@@ -1358,13 +1358,14 @@ ifnzman(noderef(The zsh/complist Module))\
 If this style is set for the tt(default) tag, the strings in the value 
 are taken as specifications that are to be used everywhere.  If it is
 set for other tags, the specifications are used only for matches of
-the type described by the tag.  For this to work, the tt(group-name)
+the type described by the tag.  For this to work best, the tt(group-name)
 style must be set to an empty string.  If the tt(group-name) tag
 specifies other names for the groups the matches in these groups can
 be colored by using these names together with the `tt((group)...)'
 syntax described for the tt(ZLS_COLORS) and tt(ZLS_COLOURS) parameters 
 and adding the specifications to the value for this style with the
-tt(default) tag.
+tt(default) tag (although in most cases it should work by setting this 
+style for the appropriate tags).
 
 It is possible to use the same specifications set up for the GNU
 version of the tt(ls) command:
@@ -3472,11 +3473,15 @@ widget locally sets the options it needs.  Hence these options are not
 generally used by the completion system.
 )
 findex(_setup)
-item(tt(_setup) var(tag))(
+item(tt(_setup) var(tag) [ var(group) ])(
 This function expects a tag as its argument and sets up the special
 parameters used by the completion system appropriately for the tag,
 using styles such as tt(list-colors) and tt(last-prompt).
 
+The optional var(group) gives the name of the group in which the
+matches will be placed. If it is not given, the var(tag) is used as
+the group name.
+
 Note that this function is called automatically from tt(_description)
 so that one normally doesn't have to call it explicitly.
 )