edit mode is now perfectly working

This commit is contained in:
filipriec
2025-03-23 10:55:05 +01:00
parent 87a572783a
commit 49fe2aa793

View File

@@ -31,6 +31,7 @@ pub async fn handle_edit_event_internal(
action, action,
form_state, form_state,
grpc_client, grpc_client,
is_saved,
current_position, current_position,
total_count, total_count,
).await; ).await;
@@ -61,10 +62,20 @@ async fn execute_common_action(
action: &str, action: &str,
form_state: &mut FormState, form_state: &mut FormState,
grpc_client: &mut GrpcClient, grpc_client: &mut GrpcClient,
is_saved: &mut bool,
current_position: &mut u64, current_position: &mut u64,
total_count: u64, total_count: u64,
) -> Result<String, Box<dyn std::error::Error>> { ) -> Result<String, Box<dyn std::error::Error>> {
match action { match action {
"save" => {
common::save(
form_state,
grpc_client,
is_saved,
current_position,
total_count,
).await
},
"revert" => { "revert" => {
common::revert( common::revert(
form_state, form_state,
@@ -72,8 +83,19 @@ async fn execute_common_action(
current_position, current_position,
total_count, total_count,
).await ).await
} },
// Add other common actions here if needed "move_up" | "move_down" => {
// Reuse edit mode's existing logic
execute_edit_action(
action,
form_state,
&mut 0, // Dummy ideal_cursor_column (not used here)
grpc_client,
is_saved,
current_position,
total_count,
).await
},
_ => Ok(format!("Common action not handled: {}", action)), _ => Ok(format!("Common action not handled: {}", action)),
} }
} }