aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/ttyplay/input.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/bin/ttyplay/input.rs')
-rw-r--r--src/bin/ttyplay/input.rs15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/bin/ttyplay/input.rs b/src/bin/ttyplay/input.rs
index 31770fd..0da0c8b 100644
--- a/src/bin/ttyplay/input.rs
+++ b/src/bin/ttyplay/input.rs
@@ -1,8 +1,5 @@
-pub async fn handle(
- key: textmode::Key,
- event_w: async_std::channel::Sender<crate::event::Event>,
-) -> anyhow::Result<()> {
- let event = match key {
+pub fn to_event(key: &textmode::Key) -> Option<crate::event::Event> {
+ Some(match key {
textmode::Key::Char('g' | '0' | ')') => {
crate::event::Event::FirstFrame
}
@@ -12,10 +9,6 @@ pub async fn handle(
textmode::Key::Char('q') => crate::event::Event::Quit,
textmode::Key::Char(' ') => crate::event::Event::Pause,
textmode::Key::Ctrl(b'i') => crate::event::Event::ToggleUi,
- _ => return Ok(()),
- };
-
- event_w.send(event).await?;
-
- Ok(())
+ _ => return None,
+ })
}