Skip to content

Commit

Permalink
Fix crash on opening from suspend state (helix-editor#6764)
Browse files Browse the repository at this point in the history
* Fix crash on opening from suspend state (helix-editor#6725)

* Fix code style

* revert using of the imperative code style. Add panic if couldn't set terminal raw mode

* remove redundant import of core::panic macros

* small refactoring
  • Loading branch information
h1t authored and wes-adams committed Jul 3, 2023
1 parent b45c0eb commit b994404
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion helix-term/src/application.rs
Original file line number Diff line number Diff line change
Expand Up @@ -471,7 +471,17 @@ impl Application {
}
}
signal::SIGCONT => {
self.claim_term().await.unwrap();
// Copy/Paste from same issue from neovim:
// https://github.com/neovim/neovim/issues/12322
// https://github.com/neovim/neovim/pull/13084
for retries in 1..=10 {
match self.claim_term().await {
Ok(()) => break,
Err(err) if retries == 10 => panic!("Failed to claim terminal: {}", err),
Err(_) => continue,
}
}

// redraw the terminal
let area = self.terminal.size().expect("couldn't get terminal size");
self.compositor.resize(area);
Expand Down

0 comments on commit b994404

Please sign in to comment.