summaryrefslogtreecommitdiffstats
path: root/src/state.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-11-17 21:45:25 -0500
committerJesse Luehrs <doy@tozt.net>2021-11-17 21:45:25 -0500
commit26bb4e54e9669b487817d09ebfa36836293d741d (patch)
treedfdedab0e497c3e62a900ca0e4ba94380bed67bd /src/state.rs
parent35cdb6a27e25504f6eb368d48f1007085883635c (diff)
downloadnbsh-26bb4e54e9669b487817d09ebfa36836293d741d.tar.gz
nbsh-26bb4e54e9669b487817d09ebfa36836293d741d.zip
make action handling the main task
Diffstat (limited to 'src/state.rs')
-rw-r--r--src/state.rs16
1 files changed, 10 insertions, 6 deletions
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 {