Files
war-in-tunnels/src/app/keybindings/settings.rs
T
GarandPLG fd0f6defea Rename GameStates to States and adjust keybindings
Replace the old `GameStates` struct with a new `states` module, rename
the
field in `App` to `states`, and update construction to pass CLI args.
Remove the now‑unused `game_states.rs` file and adjust imports
accordingly.
Update keybinding definitions: change the wildcard symbol to "[All]" and
simplify the wildcard detection logic by dropping the modifiers check.
2026-03-16 10:27:44 +01:00

30 lines
993 B
Rust

use crate::app::{
App, View,
keybindings::{Action, event_to_action},
};
use ratatui::crossterm::event::KeyEvent;
pub fn settings_keybindings(app: &mut App, key_event: &KeyEvent) {
if let Some(action) = event_to_action(&key_event) {
match action {
// Action::Up,
// Action::Down,
Action::Quit => app.exit = true,
Action::Quit2 => app.exit = true,
Action::Esc => app.view = View::MainMenu,
Action::Space => app.states.settings.show_popup = !app.states.settings.show_popup,
Action::Backspace => {
if app.states.settings.show_popup {
app.states.settings.selected_setting_new_value.pop();
}
}
Action::WildCard(c) => {
if app.states.settings.show_popup {
app.states.settings.selected_setting_new_value.push(c);
}
}
_ => (),
}
}
}