From 26bb4e54e9669b487817d09ebfa36836293d741d Mon Sep 17 00:00:00 2001 From: Jesse Luehrs Date: Wed, 17 Nov 2021 21:45:25 -0500 Subject: make action handling the main task --- src/state.rs | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/state.rs') diff --git a/src/state.rs b/src/state.rs index f12fb8a..13fd3fd 100644 --- a/src/state.rs +++ b/src/state.rs @@ -90,15 +90,19 @@ impl State { self.output.hard_refresh().await.unwrap(); self.render(false).await.unwrap(); } + crate::action::Action::Quit => { + // the debouncer should return None in this case + unreachable!(); + } } } - pub async fn handle_input(&mut self, key: textmode::Key) -> bool { + pub async fn handle_input(&mut self, key: textmode::Key) { if self.escape { - let mut ret = true; + let mut fallthrough = false; match key { textmode::Key::Ctrl(b'e') => { - ret = false; // fall through and handle normally + fallthrough = true; } textmode::Key::Ctrl(b'l') => { self.render(true).await.unwrap(); @@ -149,12 +153,12 @@ impl State { _ => {} } self.escape = false; - if ret { - return false; + if !fallthrough { + return; } } else if key == textmode::Key::Ctrl(b'e') { self.escape = true; - return false; + return; } match self.focus { -- cgit v1.2.3-54-g00ecf