1
0
Fork 0
mirror of git://git.code.sf.net/p/zsh/code synced 2025-09-03 10:21:46 +02:00

24279: allow terminal changes after zle -I to be acquired by main shell

This commit is contained in:
Peter Stephenson 2007-12-18 10:42:36 +00:00
parent ac33044bd2
commit 1ee6295909
4 changed files with 42 additions and 2 deletions

View file

@ -1,3 +1,9 @@
2007-12-18 Peter Stephenson <pws@csr.com>
* 24279: Src/jobs.c, Src/zle_main.c, Src/zle_thingy.c: allow
terminal changes in zle -I to be remembered in normal shell
settings.
2007-12-17 Peter Stephenson <pws@csr.com>
* unposted: Src/utils.c: suppress harmless warning.

View file

@ -208,10 +208,21 @@ mod_export void
zsetterm(void)
{
struct ttyinfo ti;
#if defined(FIONREAD)
int val;
#endif
if (fetchttyinfo) {
/*
* User requested terminal to be returned to normal use,
* so remember the terminal settings if not frozen.
*/
if (!ttyfrozen)
gettyinfo(&shttyinfo);
fetchttyinfo = 0;
}
#if defined(FIONREAD)
ioctl(SHTTY, FIONREAD, (char *)&val);
if (val) {
/*
@ -1113,6 +1124,7 @@ zleread(char **lp, char **rp, int flags, int context)
insmode = unset(OVERSTRIKE);
eofsent = 0;
resetneeded = 0;
fetchttyinfo = 0;
raw_lp = lp;
lpromptbuf = promptexpand(lp ? *lp : NULL, 1, NULL, NULL);
pmpt_attr = txtchange;

View file

@ -711,6 +711,17 @@ bin_zle_call(char *name, char **args, UNUSED(Options ops), UNUSED(char func))
return ret;
}
/*
* Flag that the user has requested the terminal be trashed
* for whatever use. We attempt to keep the tty settings in
* this mode synced with the normal (non-zle) settings unless
* they are frozen.
*/
/**/
int fetchttyinfo;
/**/
static int
bin_zle_invalidate(UNUSED(char *name), UNUSED(char **args), UNUSED(Options ops), UNUSED(char func))
@ -721,7 +732,18 @@ bin_zle_invalidate(UNUSED(char *name), UNUSED(char **args), UNUSED(Options ops),
* true if a completion widget is active.
*/
if (zleactive) {
int wastrashed = trashedzle;
trashzle();
if (!wastrashed && (zlereadflags & ZLRF_NOSETTY)) {
/*
* We normally wouldn't have restored the terminal
* in this case, but as it's at user request we do
* so (hence the apparently illogical sense of the
* second part of the test).
*/
settyinfo(&shttyinfo);
}
fetchttyinfo = 1;
return 0;
} else
return 1;

View file

@ -93,7 +93,7 @@ static struct tms shtms;
/* 1 if ttyctl -f has been executed */
/**/
int ttyfrozen;
mod_export int ttyfrozen;
/* Previous values of errflag and breaks if the signal handler had to
* change them. And a flag saying if it did that. */