diff options
| author | pablu <me@pablu.de> | 2026-05-07 13:07:32 +0200 |
|---|---|---|
| committer | pablu <me@pablu.de> | 2026-05-07 13:07:32 +0200 |
| commit | cc8e924ce828d237d7cdd245b794c532a4ee80d8 (patch) | |
| tree | 5fc7c118879eb0107fe20a12ff6c3096a3a36926 /src/event.rs | |
| parent | 3346222550bc18edc457d9b509f00d0eba9d0f4f (diff) | |
working search
Diffstat (limited to 'src/event.rs')
| -rw-r--r-- | src/event.rs | 27 |
1 files changed, 22 insertions, 5 deletions
diff --git a/src/event.rs b/src/event.rs index bfe1fa5..52013a5 100644 --- a/src/event.rs +++ b/src/event.rs @@ -6,11 +6,28 @@ use crate::app::App; pub fn handle_event(app: &mut App) -> io::Result<bool> { if let Event::Key(key) = event::read()? { - match key.code { - KeyCode::Char('q') => return Ok(true), - KeyCode::Char('j') => app.list_state.select_next(), - KeyCode::Char('k') => app.list_state.select_previous(), - _ => return Ok(false), + if !app.showing_search_window { + match key.code { + KeyCode::Char('q') => return Ok(true), + KeyCode::Char('j') => app.list_state.select_next(), + KeyCode::Char('k') => app.list_state.select_previous(), + KeyCode::Char('/') => app.toggle_search_window(), + _ => return Ok(false), + } + } else { + match key.code { + KeyCode::Esc => app.toggle_search_window(), + KeyCode::Enter => { + app.search(); + app.toggle_search_window(); + () + } + _ => { + app.textarea.input_without_shortcuts(key); + app.search_found = Some(app.search()); + () + } + } } } |
