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

Re: PATCH: exit after 10 EOF's



On Sun, 19 Sep 2004, Peter Stephenson wrote:

> If we could somehow make it (without too much tortuous code) that any 
> zle -N widget, no matter what it contains, suppresses the warning and 
> the EOF behaviour, I would be fairly happy.

Here's the hunk for that.  Line numbers are off because I haven't 
committed 20387 yet, so this is not directly applicable via "patch".

@@ -887,10 +897,17 @@
     } else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) {
 	int wflags = w->flags;
 
-	if (keybuf[0] == eofchar && !keybuf[1] &&
+	/*
+	 * The rule is that "zle -N" widgets suppress EOF warnings.  When
+	 * a "zle -N" widget invokes "zle another-widget" we pass through
+	 * this code again, but with actual arguments rather than with the
+	 * zlenoargs placeholder.
+	 */
+	if (keybuf[0] == eofchar && !keybuf[1] && args == zlenoargs &&
 	    !ll && isfirstln && (zlereadflags & ZLRF_IGNOREEOF)) {
 	    showmsg((!islogin) ? "zsh: use 'exit' to exit." :
 		    "zsh: use 'logout' to logout.");



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