aboutsummaryrefslogtreecommitdiffstats
path: root/src/bin/ttyplay/input.rs
blob: 0da0c8b402ae46dafb2b5c907844af73a568be81 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
pub fn to_event(key: &textmode::Key) -> Option<crate::event::Event> {
    Some(match key {
        textmode::Key::Char('g' | '0' | ')') => {
            crate::event::Event::FirstFrame
        }
        textmode::Key::Char('G' | '$') => crate::event::Event::LastFrame,
        textmode::Key::Char('l' | 'n') => crate::event::Event::NextFrame,
        textmode::Key::Char('h' | 'p') => crate::event::Event::PreviousFrame,
        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 None,
    })
}