aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
diff options
context:
space:
mode:
authorpablu <me@pablu.de>2026-05-06 17:04:31 +0200
committerpablu <me@pablu.de>2026-05-06 17:04:31 +0200
commit3346222550bc18edc457d9b509f00d0eba9d0f4f (patch)
tree5769f6b3aa3c70082e5229ad9d2ed77ca97e7a0a /src/event.rs
initial working
Diffstat (limited to 'src/event.rs')
-rw-r--r--src/event.rs18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/event.rs b/src/event.rs
new file mode 100644
index 0000000..bfe1fa5
--- /dev/null
+++ b/src/event.rs
@@ -0,0 +1,18 @@
+use std::io;
+
+use ratatui::crossterm::event::{self, Event, KeyCode};
+
+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),
+ }
+ }
+
+ Ok(false)
+}