diff options
author | Jesse Luehrs <doy@tozt.net> | 2021-11-17 21:45:25 -0500 |
---|---|---|
committer | Jesse Luehrs <doy@tozt.net> | 2021-11-17 21:45:25 -0500 |
commit | 26bb4e54e9669b487817d09ebfa36836293d741d (patch) | |
tree | dfdedab0e497c3e62a900ca0e4ba94380bed67bd /src/main.rs | |
parent | 35cdb6a27e25504f6eb368d48f1007085883635c (diff) | |
download | nbsh-26bb4e54e9669b487817d09ebfa36836293d741d.tar.gz nbsh-26bb4e54e9669b487817d09ebfa36836293d741d.zip |
make action handling the main task
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/src/main.rs b/src/main.rs index 6247d9f..05b889c 100644 --- a/src/main.rs +++ b/src/main.rs @@ -47,17 +47,15 @@ async fn async_main() -> anyhow::Result<()> { { let state = async_std::sync::Arc::clone(&state); async_std::task::spawn(async move { - let debouncer = crate::action::debounce(action_r); - while let Some(action) = debouncer.recv().await { - state.lock_arc().await.handle_action(action).await; + while let Some(key) = input.read_key().await.unwrap() { + state.lock_arc().await.handle_input(key).await; } }); } - while let Some(key) = input.read_key().await.unwrap() { - if state.lock_arc().await.handle_input(key).await { - break; - } + let debouncer = crate::action::debounce(action_r); + while let Some(action) = debouncer.recv().await { + state.lock_arc().await.handle_action(action).await; } Ok(()) |