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

Re: PATCH: _cvs



In article <199909090823.KAA02107@xxxxxxxxxxxxxxxxxxxxxxxxxxxx>,
  Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx> writes:

> The patch below is a bit of a hack: it tests if there is only one
> string in the display list and if so, it makes this string be
> displayed as if it had a newline -- so that the other groups are 
> separately put into columns.

Hm.

> Again, yes, it was. Since display lists are so special with respect to 
> listing, the `-y' enforces the opening of a new group, treated
> completely differently and *not* with the name given with `-[JV]' in
> the same call to `comp{ctl,add,gen}'.

I see.

> The patch below at least makes the explanation string be added to the
> group named by a `-[JV]' option, if any. But you still get different
> groups, i.e. the output now looks like:
> 
>   option
>   abc   def
>   mno   pqr

Z(2):akr@is27e1u11% Src/zsh -f
is27e1u11% bindkey -e; fpath=($PWD/Completion/*(/)); autoload -U compinit; compinit -D; compdef _tst tst
is27e1u11% _tst () { compadd -J option -X option -y '(mno pqr)' ghi jkl; compadd -J option -X option abc def } 
is27e1u11% tst 
mno   pqr   
option
abc   def   

This test case excahnges the order of two `compadd'. I think it's not
intentional.

Also, I modified _apt_arguments not to use -y if it is un unnecessary.

Index: Completion/Debian/_apt_arguments
===================================================================
RCS file: /projects/zsh/zsh/Completion/Debian/_apt_arguments,v
retrieving revision 1.1.1.2
diff -u -F^( -r1.1.1.2 _apt_arguments
--- _apt_arguments	1999/09/08 21:05:57	1.1.1.2
+++ _apt_arguments	1999/09/09 08:42:52
@@ -73,8 +73,12 @@
 'if [[ $PREFIX = -'"$short_seq"' ]]; then
   apt_consume_short ${PREFIX[2,-1]}
   tmp1=(${${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}#-})
-  tmp2=(-${^tmp1})
-  compadd "$expl_opt[@]" -y "($tmp2)" - ${PREFIX}${^tmp1}
+  if [[ $PREFIX = - ]]; then
+    compadd "$expl_opt[@]" - -${^tmp1}
+  else
+    tmp2=(-${^tmp1})
+    compadd "$expl_opt[@]" -y "($tmp2)" - ${PREFIX}${^tmp1}
+  fi
 elif [[ -z "$PREFIX" ]]; then
   compadd "$expl_opt[@]" - ${(M)${(s:,:)${(kj:,:)options[(R)*~0]}}:#-?}
 fi'
-- 
Tanaka Akira



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