aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/ttyplay/input.rs
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2021-12-04 19:13:26 -0500
committerJesse Luehrs <doy@tozt.net>2021-12-04 19:13:26 -0500
commit7f9c724e1b7afe81e1c07a472db75f7c0592c123 (patch)
tree7d93259c94f37e69c0dbb3384cfee6255d55f604 /src/bin/ttyplay/input.rs
parentf4c1c2b4d5e50b5266a5bffef1e2360e5fcd48cb (diff)
downloadttyrec-bin-7f9c724e1b7afe81e1c07a472db75f7c0592c123.tar.gz
ttyrec-bin-7f9c724e1b7afe81e1c07a472db75f7c0592c123.zip
split stuff out into multiple files
Diffstat (limited to 'src/bin/ttyplay/input.rs')
-rw-r--r--src/bin/ttyplay/input.rs15
1 files changed, 15 insertions, 0 deletions
diff --git a/src/bin/ttyplay/input.rs b/src/bin/ttyplay/input.rs
new file mode 100644
index 0000000..7221f63
--- /dev/null
+++ b/src/bin/ttyplay/input.rs
@@ -0,0 +1,15 @@
+pub async fn handle_input(
+ key: textmode::Key,
+ event_w: async_std::channel::Sender<crate::event::Event>,
+) -> anyhow::Result<()> {
+ match key {
+ textmode::Key::Char('q') => {
+ event_w.send(crate::event::Event::Quit).await?
+ }
+ textmode::Key::Char(' ') => {
+ event_w.send(crate::event::Event::Pause).await?;
+ }
+ _ => {}
+ }
+ Ok(())
+}