diff options
Diffstat (limited to 'helix-term')
-rw-r--r-- | helix-term/src/application.rs | 11 | ||||
-rw-r--r-- | helix-term/src/commands.rs | 6 | ||||
-rw-r--r-- | helix-term/src/compositor.rs | 2 |
3 files changed, 12 insertions, 7 deletions
diff --git a/helix-term/src/application.rs b/helix-term/src/application.rs index e75b0ecb..9622ad91 100644 --- a/helix-term/src/application.rs +++ b/helix-term/src/application.rs @@ -447,17 +447,20 @@ impl Application { // 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); - terminal::disable_raw_mode(); + // We can't handle errors properly inside this closure. And it's + // probably not a good idea to `unwrap()` inside a panic handler. + // So we just ignore the `Result`s. + let _ = execute!(std::io::stdout(), terminal::LeaveAlternateScreen); + let _ = terminal::disable_raw_mode(); hook(info); })); self.event_loop().await; - self.editor.close_language_servers(None).await; + self.editor.close_language_servers(None).await?; // reset cursor shape - write!(stdout, "\x1B[2 q"); + write!(stdout, "\x1B[2 q")?; execute!(stdout, terminal::LeaveAlternateScreen)?; diff --git a/helix-term/src/commands.rs b/helix-term/src/commands.rs index 8e5816e9..a3799e7e 100644 --- a/helix-term/src/commands.rs +++ b/helix-term/src/commands.rs @@ -1135,7 +1135,7 @@ mod cmd { match args.get(0) { Some(path) => { // TODO: handle error - cx.editor.open(path.into(), Action::Replace); + let _ = cx.editor.open(path.into(), Action::Replace); } None => { cx.editor.set_error("wrong argument count".to_string()); @@ -1367,7 +1367,9 @@ mod cmd { errors.push_str("cannot write a buffer without a filename\n"); continue; } - helix_lsp::block_on(tokio::spawn(doc.save())); + + // TODO: handle error. + let _ = helix_lsp::block_on(tokio::spawn(doc.save())); } editor.set_error(errors); diff --git a/helix-term/src/compositor.rs b/helix-term/src/compositor.rs index c3d6dee0..5fcb552a 100644 --- a/helix-term/src/compositor.rs +++ b/helix-term/src/compositor.rs @@ -141,7 +141,7 @@ impl Compositor { let (pos, kind) = self.cursor(area, cx.editor); let pos = pos.map(|pos| (pos.col as u16, pos.row as u16)); - self.terminal.draw(pos, kind); + self.terminal.draw(pos, kind).unwrap(); } pub fn cursor(&self, area: Rect, editor: &Editor) -> (Option<Position>, CursorKind) { |