mirror of
https://github.com/helix-editor/helix
synced 2024-06-01 07:46:05 +02:00
Restore terminal mode on panics.
This commit is contained in:
parent
929fa5474d
commit
91343a6846
|
@ -376,6 +376,14 @@ pub async fn run(&mut self) -> Result<(), Error> {
|
||||||
|
|
||||||
execute!(stdout, terminal::EnterAlternateScreen)?;
|
execute!(stdout, terminal::EnterAlternateScreen)?;
|
||||||
|
|
||||||
|
// Exit the alternate screen and disable raw mode before panicking
|
||||||
|
let hook = std::panic::take_hook();
|
||||||
|
std::panic::set_hook(Box::new(move |info| {
|
||||||
|
execute!(std::io::stdout(), terminal::LeaveAlternateScreen);
|
||||||
|
disable_raw_mode();
|
||||||
|
hook(info);
|
||||||
|
}));
|
||||||
|
|
||||||
self.event_loop().await;
|
self.event_loop().await;
|
||||||
|
|
||||||
// reset cursor shape
|
// reset cursor shape
|
||||||
|
|
Loading…
Reference in New Issue