diff options
Diffstat (limited to 'helix-term/src/application.rs')
-rw-r--r-- | helix-term/src/application.rs | 26 |
1 files changed, 16 insertions, 10 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index cd499f1c..4bb36b59 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -224,8 +224,8 @@ impl Application { #[cfg(windows)] let signals = futures_util::stream::empty(); #[cfg(not(windows))] - let signals = - Signals::new(&[signal::SIGTSTP, signal::SIGCONT]).context("build signal handler")?; + let signals = Signals::new(&[signal::SIGTSTP, signal::SIGCONT, signal::SIGUSR1]) + .context("build signal handler")?; let app = Self { compositor, @@ -426,23 +426,22 @@ impl Application { self.compositor.load_cursor(); self.render(); } + signal::SIGUSR1 => { + self.refresh_config(); + self.render(); + } _ => unreachable!(), } } pub fn handle_idle_timeout(&mut self) { - use crate::compositor::EventResult; - let editor_view = self - .compositor - .find::<ui::EditorView>() - .expect("expected at least one EditorView"); - let mut cx = crate::compositor::Context { editor: &mut self.editor, jobs: &mut self.jobs, scroll: None, }; - if let EventResult::Consumed(_) = editor_view.handle_idle_timeout(&mut cx) { + let should_render = self.compositor.handle_event(&Event::IdleTimeout, &mut cx); + if should_render { self.render(); } } @@ -866,9 +865,16 @@ impl Application { })); self.event_loop(input_stream).await; - self.close().await?; + + let err = self.close().await.err(); + restore_term()?; + if let Some(err) = err { + self.editor.exit_code = 1; + eprintln!("Error: {}", err); + } + Ok(self.editor.exit_code) } |