better, but more dialog logic is needed

This commit is contained in:
filipriec
2025-04-10 13:45:36 +02:00
parent 2bec0f5850
commit 5da9f5aaf4

View File

@@ -85,12 +85,19 @@ impl EventHandler {
// Check general bindings for dialog actions
if let Some(action) = config.get_general_action(key.code, key.modifiers) {
match action {
"move_down" => {
app_state.next_dialog_button();
"move_down" | "move_right" => {
let current_index = app_state.ui.dialog.dialog_active_button_index;
let num_buttons = app_state.ui.dialog.dialog_buttons.len();
if num_buttons > 0 && current_index < num_buttons - 1 {
app_state.ui.dialog.dialog_active_button_index += 1;
}
return Ok(EventOutcome::Ok(String::new())); // Consume event
}
"move_up" => {
app_state.previous_dialog_button();
"move_up" | "move_left" => {
let current_index = app_state.ui.dialog.dialog_active_button_index;
if current_index > 0 {
app_state.ui.dialog.dialog_active_button_index -= 1;
}
return Ok(EventOutcome::Ok(String::new())); // Consume event
}
"select" => {