summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorailin-nemui <ailin-nemui@users.noreply.github.com>2017-06-23 17:58:40 +0200
committerGitHub <noreply@github.com>2017-06-23 17:58:40 +0200
commitc56919768e1072985aab1377714ea5038417cd4d (patch)
tree13e8327b838037cf1cd7f8cd1e95f929eac8c38a
parent1ff2f61f090a61f3bdf0bdee5c52a7907d56acfd (diff)
parent4b1c60b2ecb030550716647bffb0f9dd7e97c31a (diff)
downloadirssi-c56919768e1072985aab1377714ea5038417cd4d.zip
Merge pull request #721 from dequis/unexpected-exits
term-terminfo: Avoid switching out of alt screen on unexpected exits
-rw-r--r--src/fe-text/term-terminfo.c13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/fe-text/term-terminfo.c b/src/fe-text/term-terminfo.c
index 3098a4e4..bca37efc 100644
--- a/src/fe-text/term-terminfo.c
+++ b/src/fe-text/term-terminfo.c
@@ -102,6 +102,17 @@ static GSourceFuncs sigcont_funcs = {
.dispatch = sigcont_dispatch
};
+static void term_atexit(void)
+{
+ if (!quitting && current_term && current_term->TI_rmcup) {
+ /* Unexpected exit, avoid switching out of alternate screen
+ to keep any on-screen errors (like noperl_die()'s) */
+ current_term->TI_rmcup = NULL;
+ }
+
+ term_deinit();
+}
+
int term_init(void)
{
struct sigaction act;
@@ -140,7 +151,7 @@ int term_init(void)
term_set_input_type(TERM_TYPE_8BIT);
term_common_init();
- atexit(term_deinit);
+ atexit(term_atexit);
return TRUE;
}