zsh-workers
 help / color / mirror / code / Atom feed
* PATCH: Re: message and menu select problem
@ 2000-04-25 13:52 Sven Wischnowsky
  0 siblings, 0 replies; only message in thread
From: Sven Wischnowsky @ 2000-04-25 13:52 UTC (permalink / raw)
  To: zsh-workers


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@informatik.hu-berlin.de


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2000-04-25 13:53 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-04-25 13:52 PATCH: Re: message and menu select problem Sven Wischnowsky

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).