Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: RE: About the new long/short options changes



Borsenkow Andrej wrote:

> >
> > > The format looks extremely impressive.
> 
> Wow! That's awsome. Now it's really time to ask what are we going to ... :-)
> 
> -andrej
> 
> Just noticed:
> 
> gdiff --TAB
> bor@itsrm2% gdiff --unidirectional-new-file
> ...
> --unidirectional-new-file-- treat absent first files as empty
>                         ^^^
> there is no space. Is it correct?

Urk.  It gets embarrassing now...

But this was really only a display problem -- I changed the separator to
not start with a spcae because that moves the explanation too far to the
right with grouping.

And since I had to fiddle with this anyway, I also added the
`list-separator' style to make the separator string configurable.  Peter
can now set that to `#' (spaces are added automatically).


Bye
  Sven

Index: Completion/AIX/Command/_lscfg
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/AIX/Command/_lscfg,v
retrieving revision 1.1
diff -u -r1.1 _lscfg
--- Completion/AIX/Command/_lscfg	2001/04/02 12:18:51	1.1
+++ Completion/AIX/Command/_lscfg	2001/07/25 12:13:41
@@ -1,6 +1,6 @@
 #compdef lscfg
 
-local state line expl curcontext="$curcontext" disp list devs
+local state line expl curcontext="$curcontext" disp list devs sep
 
 _arguments -C -s \
   '-l[display device information for named device]:device:->device' \
@@ -9,7 +9,8 @@
 if [[ "$state" = device ]]; then
   devs=( ${${${${(f)"$(lscfg)"}[6,-1]:# *}##??}/ ##[^ ]# #/:} )
   if zstyle -T ":completion:${curcontext}:devices" verbose; then
-    zformat -a list ' -- ' "$devs[@]"
+    zstyle -s ":completion:${curcontext}:devices" list-separator sep || sep=--
+    zformat -a list " $sep " "$devs[@]"
     disp=(-ld list)
   else
     disp=()
Index: Completion/AIX/Type/_logical_volumes
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/AIX/Type/_logical_volumes,v
retrieving revision 1.1
diff -u -r1.1 _logical_volumes
--- Completion/AIX/Type/_logical_volumes	2001/04/02 12:17:27	1.1
+++ Completion/AIX/Type/_logical_volumes	2001/07/25 12:13:41
@@ -1,11 +1,12 @@
 #autoload
 
-local expl list names disp
+local expl list names disp sep
 
 list=( $(lsvg -l $(lsvg)|sed  -e '2d'|awk '/[^:]* / {if ( $7 != "N/A" ) print $1 ":" $7; else print $1}' ) )
 names=(${list%%:*})
-if zstyle -T ":completion:${curcontext}" verbose; then
-  zformat -a list ' -- ' $list
+if zstyle -T ":completion:${curcontext}:" verbose; then
+  zstyle -s ":completion:${curcontext}:" list-separator sep || sep=--
+  zformat -a list " $sep " $list
   disp=(-d list)
 else
   disp=()
Index: Completion/Base/Utility/_describe
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Base/Utility/_describe,v
retrieving revision 1.4
diff -u -r1.4 _describe
--- Completion/Base/Utility/_describe	2001/07/25 08:52:34	1.4
+++ Completion/Base/Utility/_describe	2001/07/25 12:13:41
@@ -23,12 +23,13 @@
 
 zstyle -T ":completion:${curcontext}:$_type" verbose && _showd=yes
 
+zstyle -s ":completion:${curcontext}:$_type" list-separator _sep || _sep=--
+
 if zstyle -T ":completion:${curcontext}:$_type" list-grouped; then
   local _argv _new _strs _mats _opts _i=2
 
   _argv=( "$@" )
   _grp=(-g)
-  _sep='-- '
   _new=( "$1" )
   shift
 
@@ -68,7 +69,6 @@
   set - "$_argv[@]"
 else
   _grp=()
-  _sep=' -- '
 fi
 
 _descr="$1"
@@ -83,7 +83,7 @@
   while _next_label "$_type" _expl "$_descr"; do
 
     if [[ -n "$_showd" ]]; then
-      compdescribe -I "$_hide" "$_sep" _expl "$_grp[@]" "$@"
+      compdescribe -I "$_hide" "$_sep " _expl "$_grp[@]" "$@"
     else
       compdescribe -i "$_hide" "$@"
     fi
Index: Completion/Unix/Type/_printers
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Unix/Type/_printers,v
retrieving revision 1.1
diff -u -r1.1 _printers
--- Completion/Unix/Type/_printers	2001/04/02 11:41:05	1.1
+++ Completion/Unix/Type/_printers	2001/07/25 12:13:42
@@ -1,6 +1,6 @@
 #autoload
 
-local expl ret=1 list disp
+local expl ret=1 list disp sep
 
 if (( $+commands[lsallq] )); then
   # Use AIX's command to list print queues
@@ -8,6 +8,8 @@
   return
 fi
 
+zstyle -s ":completion:${curcontext}:printers" list-separator sep || sep=--
+
 if (( ! $+_lp_cache )); then
   local file entry names i
 
@@ -42,7 +44,7 @@
 fi
 
 if zstyle -T ":completion:${curcontext}:printers" verbose; then
-  zformat -a list ' -- ' "$_lp_cache[@]"
+  zformat -a list " $sep " "$_lp_cache[@]"
   disp=(-ld list)
 else
   disp=()
@@ -53,7 +55,7 @@
 (( $+_lp_alias_cache )) || return 1
 
 if zstyle -T ":completion:${curcontext}:printers" verbose; then
-  zformat -a list ' -- ' "$_lp_alias_cache[@]"
+  zformat -a list " $sep " "$_lp_alias_cache[@]"
   disp=(-ld list)
 else
   disp=()
Index: Completion/Zsh/Command/_zstyle
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Command/_zstyle,v
retrieving revision 1.3
diff -u -r1.3 _zstyle
--- Completion/Zsh/Command/_zstyle	2001/07/18 13:10:10	1.3
+++ Completion/Zsh/Command/_zstyle	2001/07/25 12:13:42
@@ -59,6 +59,7 @@
   list-packed		 c:bool
   list-prompt            c:
   list-rows-first	 c:bool
+  list-separator	 c:separator
   list-suffixes		 c:bool
   local			 c:
   match-original	 c:match-orig
@@ -308,6 +309,10 @@
 
     preserve-prefix)
       _message 'pattern matching prefix to keep'
+      ;;
+
+    separator)
+      _message 'separator string'
       ;;
 
     urgh) 
Index: Completion/Zsh/Context/_subscript
===================================================================
RCS file: /cvsroot/zsh/zsh/Completion/Zsh/Context/_subscript,v
retrieving revision 1.6
diff -u -r1.6 _subscript
--- Completion/Zsh/Context/_subscript	2001/05/08 15:09:57	1.6
+++ Completion/Zsh/Context/_subscript	2001/07/25 12:13:42
@@ -1,6 +1,6 @@
 #compdef -subscript-
 
-local expl ind osuf=']' flags
+local expl ind osuf=']' flags sep
 
 if [[ "$1" = -q ]]; then
   osuf='] '
@@ -91,7 +91,8 @@
 	      list=( "$list[@]" '' )
 	  fi
         done
-        zformat -a list ' -- ' "$list[@]"
+        zstyle -s ":completion:${curcontext}:indexes" list-separator sep || sep=--
+        zformat -a list " $sep " "$list[@]"
 	disp=( -d list)
       else
         disp=()
Index: Doc/Zsh/compsys.yo
===================================================================
RCS file: /cvsroot/zsh/zsh/Doc/Zsh/compsys.yo,v
retrieving revision 1.130
diff -u -r1.130 compsys.yo
--- Doc/Zsh/compsys.yo	2001/07/18 13:10:10	1.130
+++ Doc/Zsh/compsys.yo	2001/07/25 12:14:06
@@ -1563,6 +1563,12 @@
 components starting with the first one for which more than one match
 could be generated will be shown.
 )
+kindex(list-separator, completion style)
+item(tt(list-separator))(
+The value of this style is used in completion listing to separate the
+string to complete from a description when possible (e.g. when
+completing options).  It defaults to `tt(-)tt(-)' (two hyphens).
+)
 kindex(local, completion style)
 item(tt(local))(
 This style is used by completion functions which generate URLs as
Index: Src/Zle/computil.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/computil.c,v
retrieving revision 1.68
diff -u -r1.68 computil.c
--- Src/Zle/computil.c	2001/07/25 10:45:59	1.68
+++ Src/Zle/computil.c	2001/07/25 12:14:12
@@ -504,11 +504,12 @@
         case CRT_DESC:
             {
                 VARARR(char, buf,
-                       cd_state.pre + cd_state.suf + cd_state.slen + 1);
+                       cd_state.pre + cd_state.suf + cd_state.slen + 3);
                 char *sufp = NULL;
 
-                memcpy(buf + cd_state.pre, cd_state.sep, cd_state.slen);
-                sufp = buf + cd_state.pre + cd_state.slen;
+                memcpy(buf + cd_state.pre + 2, cd_state.sep, cd_state.slen);
+                buf[cd_state.pre] = buf[cd_state.pre + 1] = ' ';
+                sufp = buf + cd_state.pre + cd_state.slen + 2;
 
                 mats = mp = (char **) zalloc((run->count + 1) * sizeof(char *));
                 dpys = dp = (char **) zalloc((run->count + 1) * sizeof(char *));

-- 
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



Messages sorted by: Reverse Date, Date, Thread, Author