h and l movements are now working

This commit is contained in:
filipriec
2025-05-23 16:59:12 +02:00
parent 05580ac978
commit 9d55ec3e43

View File

@@ -138,6 +138,66 @@ pub fn handle_add_logic_navigation(
AddLogicFocus::InputDescription | AddLogicFocus::InputScriptContent);
handled = true;
}
Some("next_option") => { // Horizontal next
let previous_focus = add_logic_state.current_focus;
add_logic_state.current_focus = match add_logic_state.current_focus {
AddLogicFocus::InputLogicName => AddLogicFocus::InputTargetColumn,
AddLogicFocus::InputTargetColumn => AddLogicFocus::InputDescription,
AddLogicFocus::InputDescription => AddLogicFocus::InputScriptContent,
AddLogicFocus::InputScriptContent => AddLogicFocus::SaveButton,
AddLogicFocus::SaveButton => AddLogicFocus::CancelButton,
AddLogicFocus::CancelButton => AddLogicFocus::InputLogicName, // Cycle back
};
// Update canvas field index if moving within canvas inputs
if matches!(add_logic_state.current_focus, AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn | AddLogicFocus::InputDescription) {
let new_field = match add_logic_state.current_focus {
AddLogicFocus::InputLogicName => 0,
AddLogicFocus::InputTargetColumn => 1,
AddLogicFocus::InputDescription => 2,
_ => add_logic_state.current_field(), // Should not happen
};
add_logic_state.set_current_field(new_field);
}
app_state.ui.focus_outside_canvas = !matches!(
add_logic_state.current_focus,
AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn | AddLogicFocus::InputDescription
);
*command_message = format!("Focus: {:?}", add_logic_state.current_focus);
*is_edit_mode = matches!(add_logic_state.current_focus,
AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn |
AddLogicFocus::InputDescription | AddLogicFocus::InputScriptContent);
handled = true;
}
Some("previous_option") => { // Horizontal previous
let previous_focus = add_logic_state.current_focus;
add_logic_state.current_focus = match add_logic_state.current_focus {
AddLogicFocus::InputLogicName => AddLogicFocus::CancelButton, // Cycle back
AddLogicFocus::InputTargetColumn => AddLogicFocus::InputLogicName,
AddLogicFocus::InputDescription => AddLogicFocus::InputTargetColumn,
AddLogicFocus::InputScriptContent => AddLogicFocus::InputDescription,
AddLogicFocus::SaveButton => AddLogicFocus::InputScriptContent,
AddLogicFocus::CancelButton => AddLogicFocus::SaveButton,
};
// Update canvas field index if moving within canvas inputs
if matches!(add_logic_state.current_focus, AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn | AddLogicFocus::InputDescription) {
let new_field = match add_logic_state.current_focus {
AddLogicFocus::InputLogicName => 0,
AddLogicFocus::InputTargetColumn => 1,
AddLogicFocus::InputDescription => 2,
_ => add_logic_state.current_field(), // Should not happen
};
add_logic_state.set_current_field(new_field);
}
app_state.ui.focus_outside_canvas = !matches!(
add_logic_state.current_focus,
AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn | AddLogicFocus::InputDescription
);
*command_message = format!("Focus: {:?}", add_logic_state.current_focus);
*is_edit_mode = matches!(add_logic_state.current_focus,
AddLogicFocus::InputLogicName | AddLogicFocus::InputTargetColumn |
AddLogicFocus::InputDescription | AddLogicFocus::InputScriptContent);
handled = true;
}
Some("select") => {
match add_logic_state.current_focus {
AddLogicFocus::SaveButton => {