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

PATCH: Re: accept-and-menu-complete extra menu



Vin Shelton wrote:

> In pws-5 with (I think) all the patches applied, I'm seeing an extra
> menu on accept-and-menu-complete with old-style completion.
> 
>     zsh -f
>     zion% bindkey '^X\t' accept-and-menu-complete
>     zion% setopt noalwayslastprompt
>     zion% echo $ZSH_<TAB>
>     ZSH_NAME     ZSH_VERSION
> 
> pressing another TAB gives me:
>     zion% echo $ZSH_NAME                ; and then ^X-TAB yields:
>     zion% echo $ZSH_NAME $ZSH_VERSION
>     ZSH_NAME     ZSH_VERSION
>     zion% echo $ZSH_NAME $ZSH_VERSION
> 
> So, another menu appears when it shouldn't.
> 
> This was working fine in plain old pws-5, I believe.

It was. This was caused by an incomplete test in the code that makes
sure that a-a-m-c with completion inside braces allows only those
matches that match the prefix/suffix before/after the brace. In that
case the list of completions really changes and I wanted to make it
re-displayed. Which it did. Unfortunately it also re-displayed the
list when no matches were `removed' or there weren't even any braces.

Bye
 Sven

diff -u os/Zle/zle_tricky.c Src/Zle/zle_tricky.c
--- os/Zle/zle_tricky.c	Mon Oct 11 19:55:18 1999
+++ Src/Zle/zle_tricky.c	Mon Oct 11 20:03:02 1999
@@ -577,8 +577,17 @@
 	zsfree(minfo.postbr);
 	minfo.postbr = ztrdup(lastpostbr);
 
-	if (listshown)
-	    showinglist = -2;
+	if (listshown && (lastprebr || lastpostbr)) {
+	    Cmgroup g;
+	    Cmatch *m;
+
+	    for (g = amatches, m = NULL; g && (!m || !*m); g = g->next)
+		for (m = g->matches; *m; m++)
+		    if (!hasbrpsfx(*m, minfo.prebr, minfo.postbr)) {
+			showinglist = -2;
+			break;
+		    }
+	}
     }
     menuacc++;
 

--
Sven Wischnowsky                         wischnow@xxxxxxxxxxxxxxxxxxxxxxx



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