blob: 218a21b7ed98b6a56c83e72f2c5576b578a100e3 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
pub async fn handle_input(
key: textmode::Key,
event_w: async_std::channel::Sender<crate::event::Event>,
) -> anyhow::Result<()> {
match key {
textmode::Key::Char('g' | '0' | ')') => {
event_w.send(crate::event::Event::FirstFrame).await?;
}
textmode::Key::Char('G' | '$') => {
event_w.send(crate::event::Event::LastFrame).await?;
}
textmode::Key::Char('l' | 'n') => {
event_w.send(crate::event::Event::NextFrame).await?;
}
textmode::Key::Char('h' | 'p') => {
event_w.send(crate::event::Event::PreviousFrame).await?;
}
textmode::Key::Char('q') => {
event_w.send(crate::event::Event::Quit).await?;
}
textmode::Key::Char(' ') => {
event_w.send(crate::event::Event::Pause).await?;
}
_ => {}
}
Ok(())
}
|