aboutsummaryrefslogtreecommitdiff
path: root/src/nvim/tui
diff options
context:
space:
mode:
authorzeertzjq <zeertzjq@outlook.com>2023-02-04 20:14:31 +0800
committerGitHub <noreply@github.com>2023-02-04 20:14:31 +0800
commit69bb145cea56067e6e82ed0a130a51c0d611e540 (patch)
treecbb045aac106e922647bd2a24ea4dd7a4b1763d4 /src/nvim/tui
parent90333b24c3582cb017d823583d4896c8bbb8edb8 (diff)
downloadrneovim-69bb145cea56067e6e82ed0a130a51c0d611e540.tar.gz
rneovim-69bb145cea56067e6e82ed0a130a51c0d611e540.tar.bz2
rneovim-69bb145cea56067e6e82ed0a130a51c0d611e540.zip
refactor(exit): pass error message to preserve_exit() (#22097)
Problem: 1. Some calls to preserve_exit() don't put a message in IObuff, so the IObuff printed by preserve_exit() contains unrelated information. 2. If a TUI client runs out of memory or receives a deadly signal, the error message is shown on alternate screen and cannot be easily seen because the TUI exits alternate screen soon afterwards. Solution: Pass error message to preserve_exit() and exit alternate screen before printing it. Note that this doesn't fix the problem that server error messages cannot be easily seen on exit. This is tracked in #21608 and #21843.
Diffstat (limited to 'src/nvim/tui')
-rw-r--r--src/nvim/tui/tui.c5
1 files changed, 1 insertions, 4 deletions
diff --git a/src/nvim/tui/tui.c b/src/nvim/tui/tui.c
index f760e99262..fff5c865bf 100644
--- a/src/nvim/tui/tui.c
+++ b/src/nvim/tui/tui.c
@@ -458,9 +458,6 @@ static void tui_terminal_stop(TUIData *tui)
void tui_stop(TUIData *tui)
{
- if (tui->stopped) {
- return;
- }
tui_terminal_stop(tui);
stream_set_blocking(tui->input.in_fd, true); // normalize stream (#2598)
tinput_destroy(&tui->input);
@@ -470,7 +467,7 @@ void tui_stop(TUIData *tui)
}
/// Returns true if UI `ui` is stopped.
-static bool tui_is_stopped(TUIData *tui)
+bool tui_is_stopped(TUIData *tui)
{
return tui->stopped;
}