Subject: Re: Interrupt after first tabbing into a menu select clears prompt
From: Peter Stephenson <[email-masked]>
To: [email-masked]
Date: Fri, 15 Jan 2016 12:43:04 +0000
List-Id: Zsh Workers List <zsh-workers.zsh.org>

On Fri, 15 Jan 2016 19:46:25 +0800
Leo Mao <[email-masked]> wrote:
> I also encounter this regression. Is there any news about this?
> 
> I can confirm that this problem only occurs when I interrupt right after
> tabbing into the list.

It looks like this ought to help with the issue in question.
There's probably a race if you hit ^C again very quickly.

Possibly zrefresh() ought to save, reset, and finally restore the
errflag, which could help in other places.  Either that, or it
should simply refuse to redraw until the error condition is reset.

pws

diff --git a/Src/Zle/complist.c b/Src/Zle/complist.c
index 29aaee8..0ccb885 100644
--- a/Src/Zle/complist.c
+++ b/Src/Zle/complist.c
@@ -2584,6 +2584,12 @@ domenuselect(Hookdef dummy, Chdata dat)
     	if (!do_last_key) {
 	    zmult = 1;
 	    cmd = getkeycmd();
+	    /*
+	     * On interrupt, we'll exit due to cmd being empty.
+	     * Don't propagate the interrupt any further, which
+	     * can screw up redrawing.
+	     */
+	    errflag &= ~ERRFLAG_INT;
 	    if (mtab_been_reallocated) {
 		do_last_key = 1;
 		continue;