generated from GarandPLG/rust-flake-template
Refactor keybinding handling and update widgets
- Remove the old `keybindings.rs` and stop re‑exporting its symbols. - Add view‑specific handling: `App::handle_key_event` now delegates to `main_menu_keybindings` when the view is `MainMenu`. - Update imports in `app.rs`, `widget.rs`, and widget modules to use the new `app::keybindings` path. - Enhance `keybindings_widget` to display ↑, ↓ and “Space” for special keys. - Change main menu layout percentages from 90/10 to 87/13. - Reorder the `clap` import in `cli.rs` for consistency.
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
use crate::app::{
|
||||
App,
|
||||
keybindings::{Action, event_to_action},
|
||||
};
|
||||
use ratatui::crossterm::event::KeyEvent;
|
||||
|
||||
pub fn main_menu_keybindings(app: &mut App, event: &KeyEvent) {
|
||||
if let Some(action) = event_to_action(&event) {
|
||||
match action {
|
||||
Action::Quit => app.exit = true,
|
||||
_ => (),
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user