mirror of
git://git.code.sf.net/p/zsh/code
synced 2025-10-27 16:50:58 +01:00
25345, 25347: neaten interface from main shell to zle
This commit is contained in:
parent
8a466992da
commit
0c9830d23c
13 changed files with 206 additions and 122 deletions
|
|
@ -1,3 +1,11 @@
|
||||||
|
2008-07-31 Peter Stephenson <pws@csr.com>
|
||||||
|
|
||||||
|
* 25345, 25347: Src/builtin.c, Src/exec.c, Src/hist.c, Src/init.c,
|
||||||
|
Src/input.c, Src/jobs.c, Src/loop.c, Src/options.c, Src/signals.c,
|
||||||
|
Src/utils.c, Src/zsh.h, Src/Zle/zle_main.c: Neaten interface
|
||||||
|
from main shell to zle to zleentry() in main shell using
|
||||||
|
single zle_entry_pointer.
|
||||||
|
|
||||||
2008-07-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
2008-07-30 Peter Stephenson <p.w.stephenson@ntlworld.com>
|
||||||
|
|
||||||
* unposted: Doc/Zsh/func.yo: refer to DEBUG_BEFORE_CMD option.
|
* unposted: Doc/Zsh/func.yo: refer to DEBUG_BEFORE_CMD option.
|
||||||
|
|
|
||||||
|
|
@ -1809,6 +1809,72 @@ zleaftertrap(UNUSED(Hookdef dummy), UNUSED(void *dat))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static char *
|
||||||
|
zle_main_entry(int cmd, va_list ap)
|
||||||
|
{
|
||||||
|
switch (cmd) {
|
||||||
|
case ZLE_CMD_GET_LINE:
|
||||||
|
{
|
||||||
|
int *ll, *cs;
|
||||||
|
ll = va_arg(ap, int *);
|
||||||
|
cs = va_arg(ap, int *);
|
||||||
|
return zlegetline(ll, cs);
|
||||||
|
}
|
||||||
|
|
||||||
|
case ZLE_CMD_READ:
|
||||||
|
{
|
||||||
|
char **lp, **rp;
|
||||||
|
int flags, context;
|
||||||
|
|
||||||
|
lp = va_arg(ap, char **);
|
||||||
|
rp = va_arg(ap, char **);
|
||||||
|
flags = va_arg(ap, int);
|
||||||
|
context = va_arg(ap, int);
|
||||||
|
|
||||||
|
return zleread(lp, rp, flags, context);
|
||||||
|
}
|
||||||
|
|
||||||
|
case ZLE_CMD_ADD_TO_LINE:
|
||||||
|
zleaddtoline(va_arg(ap, int));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZLE_CMD_TRASH:
|
||||||
|
trashzle();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZLE_CMD_RESET_PROMPT:
|
||||||
|
zle_resetprompt();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZLE_CMD_REFRESH:
|
||||||
|
zrefresh();
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZLE_CMD_SET_KEYMAP:
|
||||||
|
zlesetkeymap(va_arg(ap, int));
|
||||||
|
break;
|
||||||
|
|
||||||
|
case ZLE_CMD_GET_KEY:
|
||||||
|
{
|
||||||
|
long do_keytmout;
|
||||||
|
int *timeout, *chrp;
|
||||||
|
|
||||||
|
do_keytmout = va_arg(ap, long);
|
||||||
|
timeout = va_arg(ap, int *);
|
||||||
|
chrp = va_arg(ap, int *);
|
||||||
|
*chrp = getbyte(do_keytmout, timeout);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
default:
|
||||||
|
#ifdef DEBUG
|
||||||
|
dputs("Bad command %d in zle_main_entry", cmd);
|
||||||
|
#endif
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
static struct builtin bintab[] = {
|
static struct builtin bintab[] = {
|
||||||
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL),
|
BUILTIN("bindkey", 0, bin_bindkey, 0, -1, 0, "evaM:ldDANmrsLRp", NULL),
|
||||||
BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcehM:m:p:r:", NULL),
|
BUILTIN("vared", 0, bin_vared, 1, 1, 0, "aAcehM:m:p:r:", NULL),
|
||||||
|
|
@ -1849,15 +1915,8 @@ int
|
||||||
setup_(UNUSED(Module m))
|
setup_(UNUSED(Module m))
|
||||||
{
|
{
|
||||||
/* Set up editor entry points */
|
/* Set up editor entry points */
|
||||||
trashzleptr = trashzle;
|
zle_entry_ptr = zle_main_entry;
|
||||||
zle_resetpromptptr = zle_resetprompt;
|
zle_load_state = 1;
|
||||||
zrefreshptr = zrefresh;
|
|
||||||
zleaddtolineptr = zleaddtoline;
|
|
||||||
zlegetlineptr = zlegetline;
|
|
||||||
zlereadptr = zleread;
|
|
||||||
zlesetkeymapptr = zlesetkeymap;
|
|
||||||
|
|
||||||
getkeyptr = getbyte;
|
|
||||||
|
|
||||||
/* initialise the thingies */
|
/* initialise the thingies */
|
||||||
init_thingies();
|
init_thingies();
|
||||||
|
|
@ -1949,15 +2008,8 @@ finish_(UNUSED(Module m))
|
||||||
zfree(vibuf[i].buf, vibuf[i].len);
|
zfree(vibuf[i].buf, vibuf[i].len);
|
||||||
|
|
||||||
/* editor entry points */
|
/* editor entry points */
|
||||||
trashzleptr = noop_function;
|
zle_entry_ptr = (ZleEntryPoint)0;
|
||||||
zle_resetpromptptr = noop_function;
|
zle_load_state = 0;
|
||||||
zrefreshptr = noop_function;
|
|
||||||
zleaddtolineptr = noop_function_int;
|
|
||||||
zlegetlineptr = NULL;
|
|
||||||
zlereadptr = fallback_zleread;
|
|
||||||
zlesetkeymapptr= noop_function_int;
|
|
||||||
|
|
||||||
getkeyptr = NULL;
|
|
||||||
|
|
||||||
zfree(clwords, clwsize * sizeof(char *));
|
zfree(clwords, clwsize * sizeof(char *));
|
||||||
zle_refresh_finish();
|
zle_refresh_finish();
|
||||||
|
|
|
||||||
|
|
@ -4754,7 +4754,7 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
char *reply, *readpmpt;
|
char *reply, *readpmpt;
|
||||||
int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1, bslash, keys = 0;
|
int bsiz, c = 0, gotnl = 0, al = 0, first, nchars = 1, bslash, keys = 0;
|
||||||
int haso = 0; /* true if /dev/tty has been opened specially */
|
int haso = 0; /* true if /dev/tty has been opened specially */
|
||||||
int isem = !strcmp(term, "emacs"), izle = zleactive && getkeyptr;
|
int isem = !strcmp(term, "emacs"), izle = zleactive;
|
||||||
char *buf, *bptr, *firstarg, *zbuforig;
|
char *buf, *bptr, *firstarg, *zbuforig;
|
||||||
LinkList readll = newlinklist();
|
LinkList readll = newlinklist();
|
||||||
FILE *oshout = NULL;
|
FILE *oshout = NULL;
|
||||||
|
|
@ -4964,7 +4964,8 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if (izle) {
|
if (izle) {
|
||||||
if ((val = getkeyptr(izle_timeout, NULL)) < 0) {
|
zleentry(ZLE_CMD_GET_KEY, izle_timeout, NULL, &val);
|
||||||
|
if (val < 0) {
|
||||||
eof = 1;
|
eof = 1;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
@ -5069,9 +5070,13 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
if (izle) {
|
if (izle) {
|
||||||
#ifdef MULTIBYTE_SUPPORT
|
#ifdef MULTIBYTE_SUPPORT
|
||||||
int key;
|
int key;
|
||||||
|
char c;
|
||||||
|
|
||||||
while ((key = getkeyptr(izle_timeout, NULL)) >= 0) {
|
for (;;) {
|
||||||
char c = (char)key;
|
zleentry(ZLE_CMD_GET_KEY, izle_timeout, NULL, &key);
|
||||||
|
if (key < 0)
|
||||||
|
break;
|
||||||
|
c = (char)key;
|
||||||
/*
|
/*
|
||||||
* If multibyte, it can't be y, so we don't care
|
* If multibyte, it can't be y, so we don't care
|
||||||
* what key gets set to; just read to end of character.
|
* what key gets set to; just read to end of character.
|
||||||
|
|
@ -5081,7 +5086,8 @@ bin_read(char *name, char **args, Options ops, UNUSED(int func))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
int key = getkeyptr(izle_timeout, NULL);
|
int key;
|
||||||
|
zleentry(ZLE_CMD_GET_KEY, izle_timeout, NULL, &key);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
readbuf[0] = (key == 'y' ? 'y' : 'n');
|
readbuf[0] = (key == 'y' ? 'y' : 'n');
|
||||||
|
|
@ -5461,7 +5467,8 @@ zread(int izle, int *readchar, long izle_timeout)
|
||||||
int ret;
|
int ret;
|
||||||
|
|
||||||
if (izle) {
|
if (izle) {
|
||||||
int c = getkeyptr(izle_timeout, NULL);
|
int c;
|
||||||
|
zleentry(ZLE_CMD_GET_KEY, izle_timeout, NULL, &c);
|
||||||
|
|
||||||
return (c < 0 ? EOF : c);
|
return (c < 0 ? EOF : c);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1376,7 +1376,7 @@ execpline(Estate state, wordcode slcode, int how, int last1)
|
||||||
pipe(synch);
|
pipe(synch);
|
||||||
|
|
||||||
if ((pid = zfork(&bgtime)) == -1) {
|
if ((pid = zfork(&bgtime)) == -1) {
|
||||||
trashzleptr();
|
zleentry(ZLE_CMD_TRASH);
|
||||||
close(synch[0]);
|
close(synch[0]);
|
||||||
close(synch[1]);
|
close(synch[1]);
|
||||||
fprintf(stderr, "zsh: job can't be suspended\n");
|
fprintf(stderr, "zsh: job can't be suspended\n");
|
||||||
|
|
|
||||||
11
Src/hist.c
11
Src/hist.c
|
|
@ -243,7 +243,7 @@ iaddtoline(int c)
|
||||||
return;
|
return;
|
||||||
if (qbang && c == bangchar && stophist < 2) {
|
if (qbang && c == bangchar && stophist < 2) {
|
||||||
exlast--;
|
exlast--;
|
||||||
zleaddtolineptr('\\');
|
zleentry(ZLE_CMD_ADD_TO_LINE, '\\');
|
||||||
}
|
}
|
||||||
if (excs > zlemetacs) {
|
if (excs > zlemetacs) {
|
||||||
excs += 1 + inbufct - exlast;
|
excs += 1 + inbufct - exlast;
|
||||||
|
|
@ -253,7 +253,7 @@ iaddtoline(int c)
|
||||||
excs = zlemetacs;
|
excs = zlemetacs;
|
||||||
}
|
}
|
||||||
exlast = inbufct;
|
exlast = inbufct;
|
||||||
zleaddtolineptr(itok(c) ? ztokens[c - Pound] : c);
|
zleentry(ZLE_CMD_ADD_TO_LINE, itok(c) ? ztokens[c - Pound] : c);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -2565,12 +2565,7 @@ bufferwords(LinkList list, char *buf, int *index)
|
||||||
int ll, cs;
|
int ll, cs;
|
||||||
char *linein;
|
char *linein;
|
||||||
|
|
||||||
if (zlegetlineptr) {
|
linein = zleentry(ZLE_CMD_GET_LINE, &ll, &cs);
|
||||||
linein = (char *)zlegetlineptr(&ll, &cs);
|
|
||||||
} else {
|
|
||||||
linein = ztrdup("");
|
|
||||||
ll = cs = 0;
|
|
||||||
}
|
|
||||||
zlemetall = ll + 1; /* length of line plus space added below */
|
zlemetall = ll + 1; /* length of line plus space added below */
|
||||||
zlemetacs = cs;
|
zlemetacs = cs;
|
||||||
|
|
||||||
|
|
|
||||||
158
Src/init.c
158
Src/init.c
|
|
@ -84,11 +84,6 @@ mod_export int hasam, hasxn;
|
||||||
/**/
|
/**/
|
||||||
mod_export int tccolours;
|
mod_export int tccolours;
|
||||||
|
|
||||||
/* Pointer to read-key function from zle */
|
|
||||||
|
|
||||||
/**/
|
|
||||||
mod_export int (*getkeyptr) _((long, int *));
|
|
||||||
|
|
||||||
/* SIGCHLD mask */
|
/* SIGCHLD mask */
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
@ -717,8 +712,6 @@ setupvals(void)
|
||||||
zero_mnumber.type = MN_INTEGER;
|
zero_mnumber.type = MN_INTEGER;
|
||||||
zero_mnumber.u.l = 0;
|
zero_mnumber.u.l = 0;
|
||||||
|
|
||||||
getkeyptr = NULL;
|
|
||||||
|
|
||||||
lineno = 1;
|
lineno = 1;
|
||||||
noeval = 0;
|
noeval = 0;
|
||||||
curhist = 0;
|
curhist = 0;
|
||||||
|
|
@ -1181,85 +1174,102 @@ noop_function_int(UNUSED(int nothing))
|
||||||
/* do nothing */
|
/* do nothing */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ZLE entry point pointers. They are defined here because the initial *
|
/*
|
||||||
* values depend on whether ZLE is linked in or not -- if it is, we *
|
* ZLE entry point pointer.
|
||||||
* avoid wasting space with the fallback functions. No other source *
|
* No other source file needs to know which modules are linked in.
|
||||||
* file needs to know which modules are linked in. */
|
*/
|
||||||
|
/**/
|
||||||
#ifdef LINKED_XMOD_zshQszle
|
mod_export ZleEntryPoint zle_entry_ptr;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* State of loading of zle.
|
||||||
|
* 0 = Not loaded, not attempted.
|
||||||
|
* 1 = Loaded successfully
|
||||||
|
* 2 = Failed to load.
|
||||||
|
*/
|
||||||
/**/
|
/**/
|
||||||
mod_export ZleVoidFn trashzleptr = noop_function;
|
mod_export int zle_load_state;
|
||||||
/**/
|
|
||||||
mod_export ZleVoidFn zle_resetpromptptr = noop_function;
|
|
||||||
/**/
|
|
||||||
mod_export ZleVoidFn zrefreshptr = noop_function;
|
|
||||||
/**/
|
|
||||||
mod_export ZleVoidIntFn zleaddtolineptr = noop_function_int;
|
|
||||||
/**/
|
|
||||||
mod_export ZleGetLineFn zlegetlineptr = NULL;
|
|
||||||
/**/
|
|
||||||
mod_export ZleReadFn zlereadptr = autoload_zleread;
|
|
||||||
/**/
|
|
||||||
mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
|
|
||||||
|
|
||||||
#else /* !LINKED_XMOD_zshQszle */
|
|
||||||
|
|
||||||
mod_export ZleVoidFn trashzleptr = noop_function;
|
|
||||||
mod_export ZleVoidFn zle_resetpromptptr = noop_function;
|
|
||||||
mod_export ZleVoidFn zrefreshptr = noop_function;
|
|
||||||
mod_export ZleVoidIntFn zleaddtolineptr = noop_function_int;
|
|
||||||
mod_export ZleGetLineFn zlegetlineptr = NULL;
|
|
||||||
# ifdef UNLINKED_XMOD_zshQszle
|
|
||||||
mod_export ZleReadFn zlereadptr = autoload_zleread;
|
|
||||||
mod_export ZleVoidIntFn zlesetkeymapptr = autoload_zlesetkeymap;
|
|
||||||
# else /* !UNLINKED_XMOD_zshQszle */
|
|
||||||
mod_export ZleReadFn zlereadptr = fallback_zleread;
|
|
||||||
mod_export ZleVoidIntFn zlesetkeymapptr = noop_function_int;
|
|
||||||
# endif /* !UNLINKED_XMOD_zshQszle */
|
|
||||||
|
|
||||||
#endif /* !LINKED_XMOD_zshQszle */
|
|
||||||
|
|
||||||
/**/
|
|
||||||
char *
|
|
||||||
autoload_zleread(char **lp, char **rp, int ha, int con)
|
|
||||||
{
|
|
||||||
zlereadptr = fallback_zleread;
|
|
||||||
if (load_module("zsh/zle", NULL, 0) != 1)
|
|
||||||
(void)load_module("zsh/compctl", NULL, 0);
|
|
||||||
return zlereadptr(lp, rp, ha, con);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
mod_export char *
|
mod_export char *
|
||||||
fallback_zleread(char **lp, UNUSED(char **rp), UNUSED(int ha), UNUSED(int con))
|
zleentry(VA_ALIST1(int cmd))
|
||||||
|
VA_DCL
|
||||||
{
|
{
|
||||||
char *pptbuf;
|
char *ret = NULL;
|
||||||
int pptlen;
|
va_list ap;
|
||||||
|
VA_DEF_ARG(int cmd);
|
||||||
|
|
||||||
pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL, NULL),
|
VA_START(ap, cmd);
|
||||||
&pptlen);
|
VA_GET_ARG(ap, cmd, int);
|
||||||
write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
|
|
||||||
free(pptbuf);
|
|
||||||
|
|
||||||
return shingetline();
|
#if defined(LINKED_XMOD_zshQszle) || defined(UNLINKED_XMOD_zshQszle)
|
||||||
}
|
/* autoload */
|
||||||
|
switch (zle_load_state) {
|
||||||
|
case 0:
|
||||||
|
if (load_module("zsh/zle", NULL, 0) != 1) {
|
||||||
|
(void)load_module("zsh/compctl", NULL, 0);
|
||||||
|
ret = zle_entry_ptr(cmd, ap);
|
||||||
|
/* Don't execute fallback code */
|
||||||
|
cmd = -1;
|
||||||
|
} else {
|
||||||
|
zle_load_state = 2;
|
||||||
|
/* Execute fallback code below */
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
/**/
|
case 1:
|
||||||
#ifdef UNLINKED_XMOD_zshQszle
|
ret = zle_entry_ptr(cmd, ap);
|
||||||
|
/* Don't execute fallback code */
|
||||||
|
cmd = -1;
|
||||||
|
break;
|
||||||
|
|
||||||
/**/
|
case 2:
|
||||||
static void
|
/* Execute fallback code */
|
||||||
autoload_zlesetkeymap(int mode)
|
break;
|
||||||
{
|
}
|
||||||
zlesetkeymapptr = noop_function_int;
|
|
||||||
(void)load_module("zsh/zle", NULL, 0);
|
|
||||||
(*zlesetkeymapptr)(mode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**/
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
switch (cmd) {
|
||||||
|
/*
|
||||||
|
* Only the read command really needs a fallback if zle
|
||||||
|
* is not available. ZLE_CMD_GET_LINE has traditionally
|
||||||
|
* had local code in bufferwords() to do this, but that'
|
||||||
|
* probably only because bufferwords() is part of completion
|
||||||
|
* and so everything to do with it is horribly complicated.
|
||||||
|
*/
|
||||||
|
case ZLE_CMD_READ:
|
||||||
|
{
|
||||||
|
char *pptbuf, **lp;
|
||||||
|
int pptlen;
|
||||||
|
|
||||||
|
lp = va_arg(ap, char **);
|
||||||
|
|
||||||
|
pptbuf = unmetafy(promptexpand(lp ? *lp : NULL, 0, NULL, NULL,
|
||||||
|
NULL),
|
||||||
|
&pptlen);
|
||||||
|
write(2, (WRITE_ARG_2_T)pptbuf, pptlen);
|
||||||
|
free(pptbuf);
|
||||||
|
|
||||||
|
ret = shingetline();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
case ZLE_CMD_GET_LINE:
|
||||||
|
{
|
||||||
|
int *ll, *cs;
|
||||||
|
|
||||||
|
ll = va_arg(ap, int *);
|
||||||
|
cs = va_arg(ap, int *);
|
||||||
|
*ll = *cs = 0;
|
||||||
|
ret = ztrdup("");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
va_end(ap);
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
/* compctl entry point pointers. Similar to the ZLE ones. */
|
/* compctl entry point pointers. Similar to the ZLE ones. */
|
||||||
|
|
||||||
/**/
|
/**/
|
||||||
|
|
|
||||||
|
|
@ -275,7 +275,8 @@ inputline(void)
|
||||||
int flags = ZLRF_HISTORY|ZLRF_NOSETTY;
|
int flags = ZLRF_HISTORY|ZLRF_NOSETTY;
|
||||||
if (isset(IGNOREEOF))
|
if (isset(IGNOREEOF))
|
||||||
flags |= ZLRF_IGNOREEOF;
|
flags |= ZLRF_IGNOREEOF;
|
||||||
ingetcline = zlereadptr(ingetcpmptl, ingetcpmptr, flags, context);
|
ingetcline = zleentry(ZLE_CMD_READ, ingetcpmptl, ingetcpmptr,
|
||||||
|
flags, context);
|
||||||
histdone |= HISTFLAG_SETTY;
|
histdone |= HISTFLAG_SETTY;
|
||||||
}
|
}
|
||||||
if (!ingetcline) {
|
if (!ingetcline) {
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,7 @@ update_job(Job jn)
|
||||||
if ((isset(NOTIFY) || job == thisjob) && (jn->stat & STAT_LOCKED)) {
|
if ((isset(NOTIFY) || job == thisjob) && (jn->stat & STAT_LOCKED)) {
|
||||||
if (printjob(jn, !!isset(LONGLISTJOBS), 0) &&
|
if (printjob(jn, !!isset(LONGLISTJOBS), 0) &&
|
||||||
zleactive)
|
zleactive)
|
||||||
zrefreshptr();
|
zleentry(ZLE_CMD_REFRESH);
|
||||||
}
|
}
|
||||||
if (sigtrapped[SIGCHLD] && job != thisjob)
|
if (sigtrapped[SIGCHLD] && job != thisjob)
|
||||||
dotrap(SIGCHLD);
|
dotrap(SIGCHLD);
|
||||||
|
|
@ -895,7 +895,7 @@ printjob(Job jn, int lng, int synch)
|
||||||
Process qn;
|
Process qn;
|
||||||
|
|
||||||
if (!synch)
|
if (!synch)
|
||||||
trashzleptr();
|
zleentry(ZLE_CMD_TRASH);
|
||||||
if (doputnl && !synch) {
|
if (doputnl && !synch) {
|
||||||
doneprint = 1;
|
doneprint = 1;
|
||||||
putc('\n', fout);
|
putc('\n', fout);
|
||||||
|
|
|
||||||
|
|
@ -245,7 +245,8 @@ execselect(Estate state, UNUSED(int do_exec))
|
||||||
int oef = errflag;
|
int oef = errflag;
|
||||||
|
|
||||||
isfirstln = 1;
|
isfirstln = 1;
|
||||||
str = zlereadptr(&prompt3, NULL, 0, ZLCON_SELECT);
|
str = zleentry(ZLE_CMD_READ, &prompt3, NULL,
|
||||||
|
0, ZLCON_SELECT);
|
||||||
if (errflag)
|
if (errflag)
|
||||||
str = NULL;
|
str = NULL;
|
||||||
errflag = oef;
|
errflag = oef;
|
||||||
|
|
@ -313,7 +314,7 @@ selectlist(LinkList l, size_t start)
|
||||||
size_t longest = 1, fct, fw = 0, colsz, t0, t1, ct;
|
size_t longest = 1, fct, fw = 0, colsz, t0, t1, ct;
|
||||||
char **arr, **ap;
|
char **arr, **ap;
|
||||||
|
|
||||||
trashzleptr();
|
zleentry(ZLE_CMD_TRASH);
|
||||||
arr = hlinklist2array(l, 0);
|
arr = hlinklist2array(l, 0);
|
||||||
for (ap = arr; *ap; ap++)
|
for (ap = arr; *ap; ap++)
|
||||||
if (strlen(*ap) > longest)
|
if (strlen(*ap) > longest)
|
||||||
|
|
|
||||||
|
|
@ -724,7 +724,7 @@ dosetopt(int optno, int value, int force)
|
||||||
return -1;
|
return -1;
|
||||||
#endif /* GETPWNAM_FAKED */
|
#endif /* GETPWNAM_FAKED */
|
||||||
} else if ((optno == EMACSMODE || optno == VIMODE) && value) {
|
} else if ((optno == EMACSMODE || optno == VIMODE) && value) {
|
||||||
(*zlesetkeymapptr)(optno);
|
zleentry(ZLE_CMD_SET_KEYMAP, optno);
|
||||||
opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0;
|
opts[(optno == EMACSMODE) ? VIMODE : EMACSMODE] = 0;
|
||||||
}
|
}
|
||||||
opts[optno] = value;
|
opts[optno] = value;
|
||||||
|
|
|
||||||
|
|
@ -1213,7 +1213,7 @@ dotrapargs(int sig, int *sigtr, void *sigfn)
|
||||||
* need to restore the display.
|
* need to restore the display.
|
||||||
*/
|
*/
|
||||||
if (zleactive && resetneeded)
|
if (zleactive && resetneeded)
|
||||||
zrefreshptr();
|
zleentry(ZLE_CMD_REFRESH);
|
||||||
|
|
||||||
if (*sigtr != ZSIG_IGNORED)
|
if (*sigtr != ZSIG_IGNORED)
|
||||||
*sigtr &= ~ZSIG_IGNORED;
|
*sigtr &= ~ZSIG_IGNORED;
|
||||||
|
|
|
||||||
|
|
@ -108,7 +108,7 @@ static void
|
||||||
zwarning(const char *cmd, const char *fmt, va_list ap)
|
zwarning(const char *cmd, const char *fmt, va_list ap)
|
||||||
{
|
{
|
||||||
if (isatty(2))
|
if (isatty(2))
|
||||||
trashzleptr();
|
zleentry(ZLE_CMD_TRASH);
|
||||||
|
|
||||||
if (cmd) {
|
if (cmd) {
|
||||||
if (unset(SHINSTDIN) || locallevel) {
|
if (unset(SHINSTDIN) || locallevel) {
|
||||||
|
|
@ -1573,8 +1573,8 @@ adjustwinsize(int from)
|
||||||
winchanged =
|
winchanged =
|
||||||
#endif /* TIOCGWINSZ */
|
#endif /* TIOCGWINSZ */
|
||||||
resetneeded = 1;
|
resetneeded = 1;
|
||||||
zrefreshptr();
|
zleentry(ZLE_CMD_REFRESH);
|
||||||
zle_resetpromptptr();
|
zleentry(ZLE_CMD_RESET_PROMPT);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
20
Src/zsh.h
20
Src/zsh.h
|
|
@ -2373,12 +2373,22 @@ enum {
|
||||||
|
|
||||||
typedef int (*CompctlReadFn) _((char *, char **, Options, char *));
|
typedef int (*CompctlReadFn) _((char *, char **, Options, char *));
|
||||||
|
|
||||||
/* ZLE entry point pointers */
|
/* ZLE entry point pointer */
|
||||||
|
|
||||||
typedef void (*ZleVoidFn) _((void));
|
typedef char * (*ZleEntryPoint)(int cmd, va_list ap);
|
||||||
typedef void (*ZleVoidIntFn) _((int));
|
|
||||||
typedef char *(*ZleReadFn) _((char **, char **, int, int));
|
/* Commands to pass to entry point */
|
||||||
typedef char *(*ZleGetLineFn) _((int *, int *));
|
|
||||||
|
enum {
|
||||||
|
ZLE_CMD_GET_LINE,
|
||||||
|
ZLE_CMD_READ,
|
||||||
|
ZLE_CMD_ADD_TO_LINE,
|
||||||
|
ZLE_CMD_TRASH,
|
||||||
|
ZLE_CMD_RESET_PROMPT,
|
||||||
|
ZLE_CMD_REFRESH,
|
||||||
|
ZLE_CMD_SET_KEYMAP,
|
||||||
|
ZLE_CMD_GET_KEY
|
||||||
|
};
|
||||||
|
|
||||||
/***************************************/
|
/***************************************/
|
||||||
/* Hooks in core. */
|
/* Hooks in core. */
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue