use ratatui::termion::event::{Event, Key};
use super::Input;
impl From<&Event> for Input {
fn from(value: &Event) -> Self {
match value {
Event::Key(key) => match key {
Key::Char('j') | Key::Down => Input::Down,
Key::Char('k') | Key::Up => Input::Up,
Key::Char('h') | Key::Left | Key::Backspace => Input::Left,
Key::Char('l') | Key::Right | Key::Char('\n') => Input::Right,
Key::Home => Input::Home,
Key::End => Input::End,
Key::PageUp => Input::PageUp,
Key::PageDown => Input::PageDown,
Key::Ctrl('h') => Input::ToggleShowHidden,
_ => Input::None,
},
_ => Input::None,
}
}
}