[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Looking for suggestions on graceful resets

From: Timothy Allen
Subject: Re: Looking for suggestions on graceful resets
Date: Tue, 18 Dec 2018 16:24:08 +1100
User-agent: Evolution 3.30.2-1

On Mon, 2018-12-17 at 21:38 -0600, Bryan Christ wrote:
> For the purpose of this question, I'm going to be thinking in terms
> of xterm escape sequences.
> The terminal sequences
> ESC [ 47 h and ESC [ 47 l 
> basically switch in and out of normal and alternate buffer modes. 
> However, when an application is using the alternate buffer and
> crashes, no sequence is emitted to indicate that I should switch back
> to the normal buffer. 

I take it you're writing a terminal emulator?

In general, terminals are full of state, and there's no reliable way to
associate some particular bit of state (like "am I in alternate buffer
mode") with a particular application, so it can get cleaned up when the
application goes away. If an application dies without cleaning up after
itself, the user has to run the "reset" command to clean things up
manually. It's a pain, but the classic ECMA48 terminal model is
optimised for backwards compatibility and ease of implementation in
solid-state logic, not for user-friendliness. :/

> Fortunately, Bash seems to emit a OSC code to set the window title
> when he regains control, so I can use that as a clue.

Bash itself doesn't do that, your distro has configured bash to do
that. Other shells might behave differently, and bash itself might
behave differently if for some reason it loads a different config (for
example, if it's not started as a login shell).

Also, lots of applications will use both alternate buffer mode and the
window title OSC code, so that's not a good trigger for a graceful

reply via email to

[Prev in Thread] Current Thread [Next in Thread]