| 1 |
use ratatui::termion::event::{Event, Key}; |
| 2 |
|
| 3 |
use super::Input; |
| 4 |
|
| 5 |
impl From<&Event> for Input { |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
fn from(value: &Event) -> Self { |
| 10 |
match value { |
| 11 |
Event::Key(key) => match key { |
| 12 |
Key::Char('j') | Key::Down => Input::Down, |
| 13 |
Key::Char('k') | Key::Up => Input::Up, |
| 14 |
Key::Char('h') | Key::Left | Key::Backspace => Input::Left, |
| 15 |
Key::Char('l') | Key::Right | Key::Char('\n') => Input::Right, |
| 16 |
Key::Home => Input::Home, |
| 17 |
Key::End => Input::End, |
| 18 |
Key::PageUp => Input::PageUp, |
| 19 |
Key::PageDown => Input::PageDown, |
| 20 |
Key::Ctrl('h') => Input::ToggleShowHidden, |
| 21 |
_ => Input::None, |
| 22 |
}, |
| 23 |
_ => Input::None, |
| 24 |
} |
| 25 |
} |
| 26 |
} |