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

PATCH: Re: message and menu select problem



Tanaka Akira wrote:

> Z(4):akr@serein% Src/zsh -f
> serein% bindkey -e; autoload -U compinit; compinit -D; compdef _tst tst
> serein% _tst () { compadd a b; _message c }
> serein% zstyle ':completion:*:messages' format '%d'
> serein% zstyle ':completion*:default' menu select=1
> serein% tst <TAB>
> c
> a   b 
> 
> First <TAB> has no problem.  But second <TAB> causes a problem.
> 
> serein% tst <TAB>
> c
> XX  a   b 
> 
> where XX is highlightend place.

Hm, this is correct, it's the dummy string added by _message and
menu-selection makes all matches visible to be able to complete them.

But this is ugly, so this makes it skip empty strings that are
normally not shown. From now on we better use only empty strings as
dummies.


Bye
 Sven

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.6
diff -u -r1.6 complist.c
--- Src/Zle/complist.c	2000/04/25 12:19:45	1.6
+++ Src/Zle/complist.c	2000/04/25 13:50:56
@@ -1589,6 +1589,12 @@
     fdat = dat;
     selectlocalmap(mskeymap);
     noselect = 0;
+    while ((menuacc &&
+	    !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr)) ||
+	   (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
+	    (!(*minfo.cur)->str || !*(*minfo.cur)->str)))
+	do_menucmp(0);
+
     mselect = (*(minfo.cur))->gnum;
     mline = 0;
     mlines = 999999;
Index: Src/Zle/compresult.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/compresult.c,v
retrieving revision 1.10
diff -u -r1.10 compresult.c
--- Src/Zle/compresult.c	2000/04/25 11:17:25	1.10
+++ Src/Zle/compresult.c	2000/04/25 13:50:57
@@ -951,8 +951,10 @@
 	    } while (!(minfo.group)->mcount);
 	    minfo.cur = minfo.group->matches;
 	}
-    } while (menuacc &&
-	     !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr));
+    } while ((menuacc &&
+	      !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr)) ||
+	     (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
+	      (!(*minfo.cur)->str || !*(*minfo.cur)->str)));
     /* ... and insert it into the command line. */
     metafy_line();
     do_single(*(minfo.cur));
@@ -972,8 +974,10 @@
 	    minfo.cur = (minfo.group)->matches + (minfo.group)->mcount - 1;
 	} else
 	    minfo.cur--;
-    } while (menuacc &&
-	     !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr));
+    } while ((menuacc &&
+	      !hasbrpsfx(*(minfo.cur), minfo.prebr, minfo.postbr)) ||
+	     (((*minfo.cur)->flags & (CMF_NOLIST | CMF_MULT)) &&
+	      (!(*minfo.cur)->str || !*(*minfo.cur)->str)));
     metafy_line();
     do_single(*(minfo.cur));
     unmetafy_line();
@@ -1244,6 +1248,11 @@
 		    if (!(m->flags & CMF_ROWS))
 			g->flags &= ~CGF_ROWS;
 		} else if (showall || !(m->flags & (CMF_NOLIST | CMF_MULT))) {
+		    if ((m->flags & (CMF_NOLIST | CMF_MULT)) &&
+			(!m->str || !*m->str)) {
+			m->flags |= CMF_HIDE;
+			continue;
+		    }
 		    l = niceztrlen(m->str);
 		    ndisp++;
 		    if (l > glong)

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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