From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 6312 invoked from network); 3 Aug 2000 07:50:06 -0000 Received: from sunsite.auc.dk (130.225.51.30) by ns1.primenet.com.au with SMTP; 3 Aug 2000 07:50:06 -0000 Received: (qmail 4827 invoked by alias); 3 Aug 2000 07:49:46 -0000 Mailing-List: contact zsh-workers-help@sunsite.auc.dk; run by ezmlm Precedence: bulk X-No-Archive: yes X-Seq: 12494 Received: (qmail 4819 invoked from network); 3 Aug 2000 07:49:44 -0000 Date: Thu, 3 Aug 2000 09:49:41 +0200 (MET DST) Message-Id: <200008030749.JAA12195@beta.informatik.hu-berlin.de> From: Sven Wischnowsky To: zsh-workers@sunsite.auc.dk In-reply-to: "Bart Schaefer"'s message of Wed, 2 Aug 2000 16:24:26 +0000 Subject: PATCH: Re: Open bugs and questions? Bart Schaefer wrote: > On Aug 2, 2:08pm, Sven Wischnowsky wrote: > } Subject: Re: Open bugs and questions? > } > } The `use 'exit' to exit' message is displayed slightly differently: > } below the prompt without displaying a new prompt. Is that ok? > > Perhaps it should respect "alwayslastprompt", or something? Nah, that's > overkill. But how does your change work when ZLE is disabled? Exactly as before. The change is entirely in zle. Only in zle_main.c, even. > } Hm, because of that and the shell-function widget thing, I'll wait > } before committing it. > > I think the shell-function-widget-thing is fine. Ok, I'll commit it then. Most of the patch is re-indentation. Bye Sven Index: Doc/Zsh/options.yo =================================================================== RCS file: /cvsroot/zsh/zsh/Doc/Zsh/options.yo,v retrieving revision 1.10 diff -u -r1.10 options.yo --- Doc/Zsh/options.yo 2000/07/19 21:37:18 1.10 +++ Doc/Zsh/options.yo 2000/08/03 07:48:55 @@ -573,6 +573,11 @@ of tt(exit) or tt(logout) instead. However, ten consecutive EOFs will cause the shell to exit anyway, to avoid the shell hanging if its tty goes away. + +Also, if this option is set and the Zsh Line Editor is used, widgets +implemented by shell functions can be bound to EOF (normally +Control-D) without printing the normal warning message. This works +only for normal widgets, not for completion widgets. ) pindex(INC_APPEND_HISTORY) cindex(history, incremental appending to a file) Index: Src/Zle/zle_main.c =================================================================== RCS file: /cvsroot/zsh/zsh/Src/Zle/zle_main.c,v retrieving revision 1.8 diff -u -r1.8 zle_main.c --- Src/Zle/zle_main.c 2000/07/27 17:48:48 1.8 +++ Src/Zle/zle_main.c 2000/08/03 07:48:59 @@ -76,7 +76,10 @@ /**/ int insmode; -static int eofchar, eofsent; +/**/ +mod_export int eofchar; + +static int eofsent; static long keytimeout; #ifdef HAVE_SELECT @@ -556,7 +559,7 @@ reselectkeymap(); selectlocalmap(NULL); bindk = getkeycmd(); - if (!ll && isfirstln && c == eofchar) { + if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) { eofsent = 1; break; } @@ -630,26 +633,33 @@ } else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) { int wflags = w->flags; - if(!(wflags & ZLE_KEEPSUFFIX)) - removesuffix(); - if(!(wflags & ZLE_MENUCMP)) { - fixsuffix(); - invalidatelist(); + if (keybuf[0] == eofchar && !keybuf[1] && + !ll && isfirstln && isset(IGNOREEOF)) { + showmsg((!islogin) ? "zsh: use 'exit' to exit." : + "zsh: use 'logout' to logout."); + ret = 1; + } else { + if(!(wflags & ZLE_KEEPSUFFIX)) + removesuffix(); + if(!(wflags & ZLE_MENUCMP)) { + fixsuffix(); + invalidatelist(); + } + if (wflags & ZLE_LINEMOVE) + vilinerange = 1; + if(!(wflags & ZLE_LASTCOL)) + lastcol = -1; + if (wflags & WIDGET_NCOMP) { + int atcurhist = histline == curhist; + compwidget = w; + ret = completecall(args); + if (atcurhist) + histline = curhist; + } else + ret = w->u.fn(args); + if (!(wflags & ZLE_NOTCOMMAND)) + lastcmd = wflags; } - if (wflags & ZLE_LINEMOVE) - vilinerange = 1; - if(!(wflags & ZLE_LASTCOL)) - lastcol = -1; - if (wflags & WIDGET_NCOMP) { - int atcurhist = histline == curhist; - compwidget = w; - ret = completecall(args); - if (atcurhist) - histline = curhist; - } else - ret = w->u.fn(args); - if (!(wflags & ZLE_NOTCOMMAND)) - lastcmd = wflags; r = 1; } else { Eprog prog = getshfunc(w->u.fnnam); -- Sven Wischnowsky wischnow@informatik.hu-berlin.de