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

Re: Menu selection



You wrote:

> Here is a recipe, that causes a core dump for me:
> 
> host% autoload -U compinit; compinit -D
> host% zmodload zsh/complist
> host% bindkey "^Bm" menu-select
> host% bindkey "^Bi" vi-insert
> host% mkdir bug ; cd bug
> host% touch a b ba bb c
> host% more [^Bm]zsh: segmentation fault  $SHELL -f
> 
> I intended to do "^Bi" after "^Bm", since menu-select usually works for me.
> I've been seeing the problem with vi-insert.

(Sorry for the delay, Felix.)

Problem was that `dat' isn't set when the menu-select widget is called
(instead of calling menu selection via styles). This should fix it.


Bye
  Sven

Index: Src/Zle/complist.c
===================================================================
RCS file: /cvsroot/zsh/zsh/Src/Zle/complist.c,v
retrieving revision 1.51
diff -u -r1.51 complist.c
--- Src/Zle/complist.c	26 Jun 2002 11:07:46 -0000	1.51
+++ Src/Zle/complist.c	3 Jul 2002 07:55:33 -0000
@@ -2201,9 +2201,9 @@
 	    menucomplete(zlenoargs);
 	    iforcemenu = 0;
 
-	    if (dat->num < 1 || !minfo.cur || !*(minfo.cur)) {
+	    if ((dat ? dat->num : nmatches) < 1 || !minfo.cur || !*(minfo.cur)) {
 		nolist = 1;
-		if (dat->nmesg || nmessages) {
+		if ((dat ? (dat->nmesg || nmessages) : nmessages)) {
 		    showinglist = -2;
 		    zrefresh();
 		} else {
@@ -2768,13 +2768,13 @@
     mselect = mlastcols = mlastlines = -1;
     mstatus = NULL;
     inselect = mhasstat = 0;
-    if (acc) {
+    if (acc && validlist && minfo.cur) {
 	menucmp = lastambig = hasoldlist = 0;
 	do_single(*(minfo.cur));
     }
     if (wasnext || broken) {
 	menucmp = 2;
-	showinglist = -2;
+	showinglist = (validlist ? -2 : 0);
 	minfo.asked = 0;
 	if (!noselect) {
 	    int nos = noselect;
@@ -2784,7 +2784,7 @@
 	}
     }
     if (!noselect && (!dat || acc)) {
-	showinglist = -2;
+	showinglist = (validlist ? -2 : 0);
 	onlyexpl = oe;
 	if (!smatches)
 	    clearlist = 1;

-- 
Sven Wischnowsky                          wischnow@xxxxxxxxx



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