aboutsummaryrefslogtreecommitdiff
path: root/src/event.rs
diff options
context:
space:
mode:
authorpablu <me@pablu.de>2026-06-02 18:49:48 +0200
committerpablu <me@pablu.de>2026-06-02 18:49:48 +0200
commitb547e6758c635682c94794e5c13070a73c918203 (patch)
tree2ca030a7acbe436a304e6b87dd93deb0b2351909 /src/event.rs
parentafe649e0efc31fcd33a828e54bd6313cd37f1784 (diff)
wip: refactor architecture
Diffstat (limited to 'src/event.rs')
-rw-r--r--src/event.rs110
1 files changed, 55 insertions, 55 deletions
diff --git a/src/event.rs b/src/event.rs
index 44a4c3e..95eece2 100644
--- a/src/event.rs
+++ b/src/event.rs
@@ -13,11 +13,11 @@ pub fn handle_event(app: &mut App) -> io::Result<bool> {
}
}
crate::app::ViewState::InstalledPackages => {
- if app.showing_search_window {
- handle_search_keybinds(key, app);
- } else if handle_installed_packages_keybinds(key, app) {
- return Ok(true);
- }
+ // if app.showing_search_window {
+ // handle_search_keybinds(key, app);
+ // } else if handle_installed_packages_keybinds(key, app) {
+ // return Ok(true);
+ // }
}
crate::app::ViewState::AvailablePackages => {
if handle_available_packages_keybinds(key, app) {
@@ -30,7 +30,7 @@ pub fn handle_event(app: &mut App) -> io::Result<bool> {
Ok(false)
}
-fn handle_available_packages_keybinds(key: KeyEvent, app: &mut App<'_>) -> bool {
+fn handle_available_packages_keybinds(key: KeyEvent, app: &mut App) -> bool {
match key.code {
KeyCode::Char('q') => return true,
KeyCode::Tab => app.cycle_current_tab(),
@@ -40,55 +40,55 @@ fn handle_available_packages_keybinds(key: KeyEvent, app: &mut App<'_>) -> bool
false
}
-
-fn handle_search_keybinds(key: KeyEvent, app: &mut App) {
- 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());
- }
- }
-}
-
-fn handle_installed_packages_keybinds(key: KeyEvent, app: &mut App) -> bool {
- match key.modifiers {
- KeyModifiers::CONTROL => match key.code {
- KeyCode::Char('d') => app
- .list_state
- .select(Some(app.list_state.selected().unwrap_or(0) + 30)),
- KeyCode::Char('u') => {
- if let Some(selected) = app.list_state.selected() {
- if selected < 30 {
- app.list_state.select(Some(0));
- } else {
- app.list_state.select(Some(selected - 30));
- }
- }
- }
- _ => {}
- },
- _ => match key.code {
- KeyCode::Char('q') => return true,
- KeyCode::Char('j') => app.list_state.select_next(),
- KeyCode::Char('k') => app.list_state.select_previous(),
- KeyCode::Char('/') => app.toggle_search_window(),
- KeyCode::Char('n') => app.next_search(),
- KeyCode::Char('N') => app.prev_search(),
-
- KeyCode::Tab => app.cycle_current_tab(),
-
- _ => {}
- },
- }
-
- false
-}
-
+//
+// fn handle_search_keybinds(key: KeyEvent, app: &mut App) {
+// 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());
+// }
+// }
+// }
+//
+// fn handle_installed_packages_keybinds(key: KeyEvent, app: &mut App) -> bool {
+// match key.modifiers {
+// KeyModifiers::CONTROL => match key.code {
+// KeyCode::Char('d') => app
+// .list_state
+// .select(Some(app.list_state.selected().unwrap_or(0) + 30)),
+// KeyCode::Char('u') => {
+// if let Some(selected) = app.list_state.selected() {
+// if selected < 30 {
+// app.list_state.select(Some(0));
+// } else {
+// app.list_state.select(Some(selected - 30));
+// }
+// }
+// }
+// _ => {}
+// },
+// _ => match key.code {
+// KeyCode::Char('q') => return true,
+// KeyCode::Char('j') => app.list_state.select_next(),
+// KeyCode::Char('k') => app.list_state.select_previous(),
+// KeyCode::Char('/') => app.toggle_search_window(),
+// KeyCode::Char('n') => app.next_search(),
+// KeyCode::Char('N') => app.prev_search(),
+//
+// KeyCode::Tab => app.cycle_current_tab(),
+//
+// _ => {}
+// },
+// }
+//
+// false
+// }
+//
fn handle_dashboard_keybinds(key: KeyEvent, app: &mut App) -> bool {
match key.code {
KeyCode::Char('q') => return true,