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:
2026-03-10 16:29:27 +01:00
parent de42569a51
commit ec1aa4fbe8
10 changed files with 112 additions and 65 deletions
+4 -2
View File
@@ -1,3 +1,4 @@
use crate::app::{View, keybindings::binding_for_view};
use ratatui::{
crossterm::event::KeyCode,
layout::Alignment,
@@ -6,13 +7,14 @@ use ratatui::{
widgets::{Block, Borders, Paragraph},
};
use crate::app::{View, binding_for_view};
pub fn keybindings_widget(view: View) -> Paragraph<'static> {
let lines: Vec<Line> = binding_for_view(view)
.iter()
.map(|b| {
let key_span = match b.code {
KeyCode::Up => Span::raw("".to_string()),
KeyCode::Down => Span::raw("".to_string()),
KeyCode::Char(' ') => Span::raw("Space".to_string()),
KeyCode::Char(c) => Span::raw(c.to_string()),
other => Span::raw(format!("{:?}", other)),
}