mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-01-12 20:51:12 +01: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>
|
||||
|
||||
* 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.
|
||||
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)
|
||||
|
|
|
@ -76,7 +76,10 @@ mod_export Thingy lbindk, bindk;
|
|||
/**/
|
||||
int insmode;
|
||||
|
||||
static int eofchar, eofsent;
|
||||
/**/
|
||||
mod_export int eofchar;
|
||||
|
||||
static int eofsent;
|
||||
static long keytimeout;
|
||||
|
||||
#ifdef HAVE_SELECT
|
||||
|
@ -556,7 +559,7 @@ zleread(char *lp, char *rp, int flags)
|
|||
reselectkeymap();
|
||||
selectlocalmap(NULL);
|
||||
bindk = getkeycmd();
|
||||
if (!ll && isfirstln && c == eofchar) {
|
||||
if (!ll && isfirstln && unset(IGNOREEOF) && c == eofchar) {
|
||||
eofsent = 1;
|
||||
break;
|
||||
}
|
||||
|
@ -630,26 +633,33 @@ execzlefunc(Thingy func, char **args)
|
|||
} 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);
|
||||
|
|
Loading…
Reference in a new issue