From 49fe2aa793f44a2642ebb352339f3ee82b6cde68 Mon Sep 17 00:00:00 2001 From: filipriec Date: Sun, 23 Mar 2025 10:55:05 +0100 Subject: [PATCH] edit mode is now perfectly working --- client/src/modes/handlers/edit.rs | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/client/src/modes/handlers/edit.rs b/client/src/modes/handlers/edit.rs index 09d587b..9a5bbe7 100644 --- a/client/src/modes/handlers/edit.rs +++ b/client/src/modes/handlers/edit.rs @@ -31,6 +31,7 @@ pub async fn handle_edit_event_internal( action, form_state, grpc_client, + is_saved, current_position, total_count, ).await; @@ -61,10 +62,20 @@ async fn execute_common_action( action: &str, form_state: &mut FormState, grpc_client: &mut GrpcClient, + is_saved: &mut bool, current_position: &mut u64, total_count: u64, ) -> Result> { match action { + "save" => { + common::save( + form_state, + grpc_client, + is_saved, + current_position, + total_count, + ).await + }, "revert" => { common::revert( form_state, @@ -72,8 +83,19 @@ async fn execute_common_action( current_position, total_count, ).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)), } }