refactor: Migrated the handle_table_events macro into a trait for better IDE support, created a TableEventAdapter wrapper for the KeyEventHandlers to make it so that the trait can be used properly and a simple function to replace the previous call to the handle_table_events macro

This commit is contained in:
2025-12-04 16:03:58 -07:00
parent 71240373c0
commit 35dce0bf01
42 changed files with 1425 additions and 756 deletions
+12
View File
@@ -93,6 +93,18 @@ pub trait KeyEventHandler<'a, 'b, T: Into<Route> + Copy> {
fn handle_submit(&mut self);
fn handle_esc(&mut self);
fn handle_char_key_event(&mut self);
/// Returns a mutable reference to the application state.
///
/// This method is used by the trait-based table handler to modify app state during
/// table operations (e.g., navigation stack, loading flags).
fn app_mut(&mut self) -> &mut App<'b>;
/// Returns the current navigation route.
///
/// This method is used by the trait-based table handler to determine which screen
/// or mode is currently active, enabling context-aware event handling.
fn current_route(&self) -> Route;
}
pub fn handle_events(key: Key, app: &mut App<'_>) {