diff options
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | Src/Zle/zle_main.c | 14 | ||||
-rw-r--r-- | Src/Zle/zle_thingy.c | 22 | ||||
-rw-r--r-- | Src/jobs.c | 2 |
4 files changed, 42 insertions, 2 deletions
diff --git a/ChangeLog b/ChangeLog index 61bbe551c..4d7333aa6 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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. diff --git a/Src/Zle/zle_main.c b/Src/Zle/zle_main.c index 2817f9249..e29b759e9 100644 --- a/Src/Zle/zle_main.c +++ b/Src/Zle/zle_main.c @@ -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; diff --git a/Src/Zle/zle_thingy.c b/Src/Zle/zle_thingy.c index 536ddcd6a..fb0dbb092 100644 --- a/Src/Zle/zle_thingy.c +++ b/Src/Zle/zle_thingy.c @@ -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; diff --git a/Src/jobs.c b/Src/jobs.c index 95acf8eb1..9bdc602de 100644 --- a/Src/jobs.c +++ b/Src/jobs.c @@ -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. */ |