about summary refs log tree commit diff
path: root/Completion/Base
diff options
context:
space:
mode:
authorSven Wischnowsky <wischnow@users.sourceforge.net>2001-07-25 08:52:34 +0000
committerSven Wischnowsky <wischnow@users.sourceforge.net>2001-07-25 08:52:34 +0000
commiteba59194d72250402bdbb97a866ffea89ec9d7a7 (patch)
tree607dc8f64428fb9f749405c96e7c3e7969739cce /Completion/Base
parent6d81779954a9a5ef64c87a21ce131190a1214d7c (diff)
downloadzsh-eba59194d72250402bdbb97a866ffea89ec9d7a7.tar.gz
zsh-eba59194d72250402bdbb97a866ffea89ec9d7a7.tar.xz
zsh-eba59194d72250402bdbb97a866ffea89ec9d7a7.zip
make display for groups in _describe nicer; improve packing with list_packed; leave space for type character (list_types) only in groups with at least one file name (15477)
Diffstat (limited to 'Completion/Base')
-rw-r--r--Completion/Base/Utility/_describe40
1 files changed, 16 insertions, 24 deletions
diff --git a/Completion/Base/Utility/_describe b/Completion/Base/Utility/_describe
index 45b8c17d6..2783c25d1 100644
--- a/Completion/Base/Utility/_describe
+++ b/Completion/Base/Utility/_describe
@@ -2,8 +2,9 @@
 
 # This can be used to add options or values with descriptions as matches.
 
-local _opt _expl _tmps _tmpd _tmph _tmpmd _tmpms _tmpmh
-local _type=values _descr _ret=1 _showd _nm _hide _args _grp
+local _opt _expl _tmpm _tmpd
+local _type=values _descr _ret=1 _showd _nm _hide _args _grp _sep
+local csl="$compstate[list]" csl2
 
 # Get the option.
 
@@ -27,6 +28,7 @@ if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then
 
   _argv=( "$@" )
   _grp=(-g)
+  _sep='-- '
   _new=( "$1" )
   shift
 
@@ -66,43 +68,33 @@ if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then
   set - "$_argv[@]"
 else
   _grp=()
+  _sep=' -- '
 fi
 
 _descr="$1"
 shift
 
 [[ "$_type" = options ]] &&
-    zstyle -t ":completion:${curcontext}:options" prefix-hidden && _hide=yes
+    zstyle -t ":completion:${curcontext}:options" prefix-hidden &&
+        _hide="${(M)PREFIX##(--|[-+])}"
 
 _tags "$_type"
 while _tags; do
   while _next_label "$_type" _expl "$_descr"; do
 
     if [[ -n "$_showd" ]]; then
-      compdescribe -I ' -- ' "$_grp[@]" "$@"
+      compdescribe -I "$_hide" "$_sep" _expl "$_grp[@]" "$@"
     else
-      compdescribe -i "$@"
+      compdescribe -i "$_hide" "$@"
     fi
 
-    while compdescribe -g _args _tmpd _tmpmd _tmph _tmpmh _tmps _tmpms; do
-
-      # See if we should remove the option prefix characters.
-
-      if [[ -n "$_hide" ]]; then
-        if [[ "$PREFIX" = --* ]]; then
-          _tmpd=( "${(@)_tmpd#--}" )
-          _tmph=( "${(@)_tmph#--}" )
-          _tmps=( "${(@)_tmps#--}" )
-        elif [[ "$PREFIX" = [-+]* ]]; then
-          _tmpd=( "${(@)_tmpd#[-+]}" )
-          _tmph=( "${(@)_tmph#[-+]}" )
-          _tmps=( "${(@)_tmps#[-+]}" )
-        fi
-      fi
-
-      compadd "$_args[@]" "$_expl[@]" -ld _tmpd -a _tmpmd && _ret=0
-      compadd -n "$_args[@]" "$_expl[@]" -ld _tmph -a _tmpmh && _ret=0
-      compadd "$_args[@]" "$_expl[@]" -d _tmps  -a _tmpms && _ret=0
+    compstate[list]="$csl"
+
+    while compdescribe -g csl2 _args _tmpm _tmpd; do
+
+      compstate[list]="$csl $csl2"
+
+      compadd "$_args[@]" -d _tmpd -a _tmpm && _ret=0
     done
   done
   (( _ret )) || return 0