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

Re: PATCH: _cvs



Tanaka Akira wrote:

> 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.

Yes, I just stumbled over this, too. The problem was just that the
group named by the `-[JV]' wasn't created before the one for the `-y', 
so the explanation string showed up in the wrong place.

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

Yep, I've just done something similar for `_display'.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Thu Sep  9 11:04:39 1999
+++ Src/Zle/zle_tricky.c	Thu Sep  9 11:07:58 1999
@@ -3951,16 +3951,21 @@
 		} else
 		    dat->prpre = dupstring(dat->prpre);
 		/* Select the group in which to store the matches. */
-		if (dat->group || dat->ylist) {
+		if (dat->group) {
 		    endcmgroup(NULL);
-		    begcmgroup((dat->ylist ? NULL : dat->group),
-			       (dat->aflags & CAF_NOSORT));
+		    begcmgroup(dat->group, (dat->aflags & CAF_NOSORT));
 		    if (dat->aflags & CAF_NOSORT)
 			mgroup->flags |= CGF_NOSORT;
 		} else {
 		    endcmgroup(NULL);
 		    begcmgroup("default", 0);
 		}
+		if (dat->ylist) {
+		    endcmgroup(NULL);
+		    begcmgroup(NULL, (dat->aflags & CAF_NOSORT));
+		    if (dat->aflags & CAF_NOSORT)
+			mgroup->flags |= CGF_NOSORT;
+		}
 		/* Select the set of matches. */
 		oisalt = (dat->aflags & CAF_ALT);
 
@@ -5944,9 +5949,13 @@
     curcc = cc;
 
     mflags = 0;
-    if (cc->ylist || cc->gname) {
+    if (cc->gname) {
+	endcmgroup(NULL);
+	begcmgroup(cc->gname, cc->mask2 & CC_NOSORT);
+    }
+    if (cc->ylist) {
 	endcmgroup(NULL);
-	begcmgroup((cc->ylist ? NULL : cc->gname), cc->mask2 & CC_NOSORT);
+	begcmgroup(NULL, cc->mask2 & CC_NOSORT);
     }
     if (cc->mask & CC_REMOVE)
 	mflags |= CMF_REMOVE;
--- oldcompletion/Core/_display	Wed Sep  8 16:19:38 1999
+++ Completion/Core/_display	Thu Sep  9 11:11:56 1999
@@ -39,7 +39,7 @@
   # descriptions.
 
   _simple=()
-  _len=1
+  _len=-1
   for _i in "$_arr[@]";  do
     _tmp="${#_i%%:*}"
     if [[ "$_i" = *:?* ]]; then
@@ -48,6 +48,11 @@
       _simple=( "$_simple[@]" "${_i%:}" )
     fi
   done
+
+  if [[ _len -lt 0 ]]; then
+    eval "${_param}=''"
+    return 1
+  fi
 
   # Now we build the list in `_tmp', adding one line per string.
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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