From f6c2fd627f2a1c82e883f4290eb834005001ab7f Mon Sep 17 00:00:00 2001 From: filipriec Date: Sun, 24 Aug 2025 16:00:58 +0200 Subject: [PATCH] fixing is_edit_mode --- client/src/bottom_panel/status_line.rs | 1 - client/src/components/admin/add_logic.rs | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/client/src/bottom_panel/status_line.rs b/client/src/bottom_panel/status_line.rs index 6777cbe..ff46536 100644 --- a/client/src/bottom_panel/status_line.rs +++ b/client/src/bottom_panel/status_line.rs @@ -16,7 +16,6 @@ pub fn render_status_line( area: Rect, current_dir: &str, theme: &Theme, - is_edit_mode: bool, current_fps: f64, app_state: &AppState, ) { diff --git a/client/src/components/admin/add_logic.rs b/client/src/components/admin/add_logic.rs index 1df01da..6dfe3ea 100644 --- a/client/src/components/admin/add_logic.rs +++ b/client/src/components/admin/add_logic.rs @@ -20,7 +20,6 @@ pub fn render_add_logic( theme: &Theme, app_state: &AppState, add_logic_state: &mut AddLogicState, - is_edit_mode: bool, ) { let main_block = Block::default() .title(" Add New Logic Script ") @@ -35,7 +34,11 @@ pub fn render_add_logic( // Handle full-screen script editing if add_logic_state.current_focus == AddLogicFocus::InsideScriptContent { let mut editor_ref = add_logic_state.script_content_editor.borrow_mut(); - let border_style_color = if is_edit_mode { theme.highlight } else { theme.secondary }; + let border_style_color = if editor.mode() == canvas::AppMode::Edit { + theme.highlight + } else { + theme.secondary + }; let border_style = Style::default().fg(border_style_color); editor_ref.set_cursor_line_style(Style::default()); @@ -47,7 +50,7 @@ pub fn render_add_logic( format!("Script {}", vim_mode_status) } EditorKeybindingMode::Emacs | EditorKeybindingMode::Default => { - if is_edit_mode { + if editor.mode() == canvas::AppMode::Edit { "Script (Editing)".to_string() } else { "Script".to_string() @@ -162,8 +165,7 @@ pub fn render_add_logic( let active_field_rect = render_canvas(f, canvas_area, &editor, theme); // --- Render Autocomplete for Target Column --- - // `is_edit_mode` here refers to the general edit mode of the EventHandler - if is_edit_mode && editor.current_field() == 1 { // Target Column field + if editor.mode() == canvas::AppMode::Edit && editor.current_field() == 1 { // Target Column field if add_logic_state.in_target_column_suggestion_mode && add_logic_state.show_target_column_suggestions { if !add_logic_state.target_column_suggestions.is_empty() { if let Some(input_rect) = active_field_rect {