|
|
@ -447,17 +447,20 @@ impl Application {
|
|
|
|
// Exit the alternate screen and disable raw mode before panicking
|
|
|
|
// Exit the alternate screen and disable raw mode before panicking
|
|
|
|
let hook = std::panic::take_hook();
|
|
|
|
let hook = std::panic::take_hook();
|
|
|
|
std::panic::set_hook(Box::new(move |info| {
|
|
|
|
std::panic::set_hook(Box::new(move |info| {
|
|
|
|
execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
|
|
|
|
// We can't handle errors properly inside this closure. And it's
|
|
|
|
terminal::disable_raw_mode();
|
|
|
|
// probably not a good idea to `unwrap()` inside a panic handler.
|
|
|
|
|
|
|
|
// So we just ignore the `Result`s.
|
|
|
|
|
|
|
|
let _ = execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
|
|
|
|
|
|
|
|
let _ = terminal::disable_raw_mode();
|
|
|
|
hook(info);
|
|
|
|
hook(info);
|
|
|
|
}));
|
|
|
|
}));
|
|
|
|
|
|
|
|
|
|
|
|
self.event_loop().await;
|
|
|
|
self.event_loop().await;
|
|
|
|
|
|
|
|
|
|
|
|
self.editor.close_language_servers(None).await;
|
|
|
|
self.editor.close_language_servers(None).await?;
|
|
|
|
|
|
|
|
|
|
|
|
// reset cursor shape
|
|
|
|
// reset cursor shape
|
|
|
|
write!(stdout, "\x1B[2 q");
|
|
|
|
write!(stdout, "\x1B[2 q")?;
|
|
|
|
|
|
|
|
|
|
|
|
execute!(stdout, terminal::LeaveAlternateScreen)?;
|
|
|
|
execute!(stdout, terminal::LeaveAlternateScreen)?;
|
|
|
|
|
|
|
|
|
|
|
|