Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Re: Open bugs and questions?
- X-seq: zsh-workers 12494
- From: Sven Wischnowsky <wischnow@xxxxxxxxxxxxxxxxxxxxxxx>
- To: zsh-workers@xxxxxxxxxxxxxx
- Subject: PATCH: Re: Open bugs and questions?
- Date: Thu, 3 Aug 2000 09:49:41 +0200 (MET DST)
- In-reply-to: "Bart Schaefer"'s message of Wed, 2 Aug 2000 16:24:26 +0000
- Mailing-list: contact zsh-workers-help@xxxxxxxxxxxxxx; run by ezmlm
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@xxxxxxxxxxxxxxxxxxxxxxx
Messages sorted by:
Reverse Date,
Date,
Thread,
Author