split config in modes/canvas is fixed and working properly well

This commit is contained in:
filipriec
2025-03-31 15:12:50 +02:00
parent 26cf06df14
commit efb59c5571
2 changed files with 7 additions and 10 deletions

View File

@@ -4,9 +4,8 @@
use crossterm::event::{KeyEvent, KeyCode, KeyModifiers}; use crossterm::event::{KeyEvent, KeyCode, KeyModifiers};
use crate::config::binds::config::Config; use crate::config::binds::config::Config;
use crate::state::pages::form::FormState; use crate::state::pages::form::FormState;
use crate::tui::functions::common::form::{save, revert};
use crate::services::grpc_client::GrpcClient; use crate::services::grpc_client::GrpcClient;
use crate::tui::functions::common::form::{save, revert};
pub async fn handle_edit_event_internal( pub async fn handle_edit_event_internal(
key: KeyEvent, key: KeyEvent,
@@ -68,7 +67,7 @@ async fn execute_common_action(
) -> Result<String, Box<dyn std::error::Error>> { ) -> Result<String, Box<dyn std::error::Error>> {
match action { match action {
"save" => { "save" => {
common::save( save(
form_state, form_state,
grpc_client, grpc_client,
is_saved, is_saved,
@@ -77,7 +76,7 @@ async fn execute_common_action(
).await ).await
}, },
"revert" => { "revert" => {
common::revert( revert(
form_state, form_state,
grpc_client, grpc_client,
current_position, current_position,
@@ -178,7 +177,7 @@ async fn execute_edit_action(
) -> Result<String, Box<dyn std::error::Error>> { ) -> Result<String, Box<dyn std::error::Error>> {
match action { match action {
"save" => { "save" => {
common::save( save(
form_state, form_state,
grpc_client, // Changed from AppTerminal grpc_client, // Changed from AppTerminal
is_saved, is_saved,

View File

@@ -6,9 +6,7 @@ use crate::services::grpc_client::GrpcClient;
use crate::state::pages::form::FormState; use crate::state::pages::form::FormState;
use crate::tui::functions::common::commands::CommandHandler; use crate::tui::functions::common::commands::CommandHandler;
use crate::tui::terminal::core::TerminalCore; use crate::tui::terminal::core::TerminalCore;
use crate::modes::{ use crate::tui::functions::common::form::{save, revert};
canvas::{common},
};
pub async fn handle_command_event( pub async fn handle_command_event(
key: KeyEvent, key: KeyEvent,
@@ -97,7 +95,7 @@ async fn process_command(
Ok((should_exit, message, true)) Ok((should_exit, message, true))
}, },
"save" => { "save" => {
let message = common::save( let message = save(
form_state, form_state,
grpc_client, grpc_client,
&mut command_handler.is_saved, &mut command_handler.is_saved,
@@ -108,7 +106,7 @@ async fn process_command(
return Ok((false, message, true)); return Ok((false, message, true));
}, },
"revert" => { "revert" => {
let message = common::revert( let message = revert(
form_state, form_state,
grpc_client, grpc_client,
current_position, current_position,