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