smart way, but introduced many errors

This commit is contained in:
filipriec
2025-03-31 17:55:53 +02:00
parent b2fc681e73
commit 306f4de14f
2 changed files with 27 additions and 13 deletions

View File

@@ -7,10 +7,10 @@ use crate::state::pages::form::FormState;
use crate::services::grpc_client::GrpcClient; use crate::services::grpc_client::GrpcClient;
use crate::tui::functions::common::form::{save, revert}; use crate::tui::functions::common::form::{save, revert};
pub async fn handle_edit_event_internal( pub async fn handle_edit_event_internal<S: CanvasState>(
key: KeyEvent, key: KeyEvent,
config: &Config, config: &Config,
form_state: &mut FormState, state: &mut S,
ideal_cursor_column: &mut usize, ideal_cursor_column: &mut usize,
command_message: &mut String, command_message: &mut String,
is_saved: &mut bool, is_saved: &mut bool,

View File

@@ -210,17 +210,31 @@ impl EventHandler {
} }
// Let edit mode handle its own actions (including navigation from common bindings) // Let edit mode handle its own actions (including navigation from common bindings)
let result = edit::handle_edit_event_internal( if app_state.ui.show_login {
key, let result = edit::handle_edit_event_internal(
config, key,
form_state, config,
&mut self.ideal_cursor_column, &mut self.auth_state, // Use auth_state instead of form_state
&mut self.command_message, &mut self.ideal_cursor_column,
&mut app_state.ui.is_saved, &mut self.command_message,
current_position, &mut app_state.ui.is_saved,
total_count, current_position,
grpc_client, total_count,
).await?; grpc_client,
).await?;
} else {
let result = edit::handle_edit_event_internal(
key,
config,
form_state,
&mut self.ideal_cursor_column,
&mut self.command_message,
&mut app_state.ui.is_saved,
current_position,
total_count,
grpc_client,
).await?;
}
self.key_sequence_tracker.reset(); self.key_sequence_tracker.reset();
return Ok((false, result)); return Ok((false, result));