From 5da9f5aaf45f48f6ccf7c0b4ac3f447a316a9297 Mon Sep 17 00:00:00 2001 From: filipriec Date: Thu, 10 Apr 2025 13:45:36 +0200 Subject: [PATCH] better, but more dialog logic is needed --- client/src/modes/handlers/event.rs | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/client/src/modes/handlers/event.rs b/client/src/modes/handlers/event.rs index 8ab0ffd..b1f6872 100644 --- a/client/src/modes/handlers/event.rs +++ b/client/src/modes/handlers/event.rs @@ -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" => {