mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-09-19 03:31:14 +02:00
make binding of ^D be used in first column if ignoreeof is set and ^D is bound to a shell function widget (12494)
This commit is contained in:
parent
4f1aa826f5
commit
a23d39ce38
3 changed files with 42 additions and 21 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
2000-08-03 Sven Wischnowsky <wischnow@zsh.org>
|
||||||
|
|
||||||
|
* 12494: Doc/Zsh/options.yo, Src/Zle/zle_main.c: make binding of
|
||||||
|
^D be used in first column if ignoreeof is set and ^D is bound to
|
||||||
|
a shell function widget
|
||||||
|
|
||||||
2000-08-02 Peter Stephenson <pws@csr.com>
|
2000-08-02 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
* Andrej: 12487: configure.in, Etc/MACHINES, Src/Makefile.in,
|
* Andrej: 12487: configure.in, Etc/MACHINES, Src/Makefile.in,
|
||||||
|
|
|
@ -573,6 +573,11 @@ Do not exit on end-of-file. Require the use
|
||||||
of tt(exit) or tt(logout) instead.
|
of tt(exit) or tt(logout) instead.
|
||||||
However, ten consecutive EOFs will cause the shell to exit anyway,
|
However, ten consecutive EOFs will cause the shell to exit anyway,
|
||||||
to avoid the shell hanging if its tty goes away.
|
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)
|
pindex(INC_APPEND_HISTORY)
|
||||||
cindex(history, incremental appending to a file)
|
cindex(history, incremental appending to a file)
|
||||||
|
|
|
@ -76,7 +76,10 @@ mod_export Thingy lbindk, bindk;
|
||||||
/**/
|
/**/
|
||||||
int insmode;
|
int insmode;
|
||||||
|
|
||||||
static int eofchar, eofsent;
|
/**/
|
||||||
|
mod_export int eofchar;
|
||||||
|
|
||||||
|
static int eofsent;
|
||||||
static long keytimeout;
|
static long keytimeout;
|
||||||
|
|
||||||
#ifdef HAVE_SELECT
|
#ifdef HAVE_SELECT
|
||||||
|
@ -556,7 +559,7 @@ zleread(char *lp, char *rp, int flags)
|
||||||
reselectkeymap();
|
reselectkeymap();
|
||||||
selectlocalmap(NULL);
|
selectlocalmap(NULL);
|
||||||
bindk = getkeycmd();
|
bindk = getkeycmd();
|
||||||
if (!ll && isfirstln && c == eofchar) {
|
if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) {
|
||||||
eofsent = 1;
|
eofsent = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -630,6 +633,12 @@ execzlefunc(Thingy func, char **args)
|
||||||
} else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) {
|
} else if((w = func->widget)->flags & (WIDGET_INT|WIDGET_NCOMP)) {
|
||||||
int wflags = w->flags;
|
int wflags = w->flags;
|
||||||
|
|
||||||
|
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))
|
if(!(wflags & ZLE_KEEPSUFFIX))
|
||||||
removesuffix();
|
removesuffix();
|
||||||
if(!(wflags & ZLE_MENUCMP)) {
|
if(!(wflags & ZLE_MENUCMP)) {
|
||||||
|
@ -650,6 +659,7 @@ execzlefunc(Thingy func, char **args)
|
||||||
ret = w->u.fn(args);
|
ret = w->u.fn(args);
|
||||||
if (!(wflags & ZLE_NOTCOMMAND))
|
if (!(wflags & ZLE_NOTCOMMAND))
|
||||||
lastcmd = wflags;
|
lastcmd = wflags;
|
||||||
|
}
|
||||||
r = 1;
|
r = 1;
|
||||||
} else {
|
} else {
|
||||||
Eprog prog = getshfunc(w->u.fnnam);
|
Eprog prog = getshfunc(w->u.fnnam);
|
||||||
|
|
Loading…
Reference in a new issue