on master help sign in
Fix crash on opening from suspend state (#6764)

* Fix crash on opening from suspend state (#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

commit1b016a89d546fb84d3c737d7c4bacb9e26c8b893 authorshem <vsv@scade.io> dateSun 16 Apr 2023, 23:07 (4 years ago) parent7706ff7
1 file changed+11−1
helix-term/src/application.rs+11−1
helix-term/src/application.rs+11−1
@@ -471,7 +471,17 @@ impl Application {
471471 }
472472 }
473473 signal::SIGCONT => {
474− self.claim_term().await.unwrap();
474+ // Copy/Paste from same issue from neovim:
475+ // https://github.com/neovim/neovim/issues/12322
476+ // https://github.com/neovim/neovim/pull/13084
477+ for retries in 1..=10 {
478+ match self.claim_term().await {
479+ Ok(()) => break,
480+ Err(err) if retries == 10 => panic!("Failed to claim terminal: {}", err),
481+ Err(_) => continue,
482+ }
483+ }
484+
475485 // redraw the terminal
476486 let area = self.terminal.size().expect("couldn't get terminal size");
477487 self.compositor.resize(area);