From 82e96f7b86faac2b005927c92c0725042abdedf7 Mon Sep 17 00:00:00 2001 From: filipriec Date: Sat, 24 May 2025 19:25:35 +0200 Subject: [PATCH] vim or default mode workin properly now --- client/config.toml | 2 -- client/src/config/binds/config.rs | 2 +- .../functions/modes/navigation/admin_nav.rs | 26 ++++++------------- 3 files changed, 9 insertions(+), 21 deletions(-) diff --git a/client/config.toml b/client/config.toml index 667f638..9698bff 100644 --- a/client/config.toml +++ b/client/config.toml @@ -85,8 +85,6 @@ revert = ["r"] [editor] keybinding_mode = "vim" # Options: "default", "vim", "emacs" -show_line_numbers = true -tab_width = 4 [colors] theme = "dark" diff --git a/client/src/config/binds/config.rs b/client/src/config/binds/config.rs index 4ba1f28..861bbb6 100644 --- a/client/src/config/binds/config.rs +++ b/client/src/config/binds/config.rs @@ -19,7 +19,7 @@ pub enum EditorKeybindingMode { impl Default for EditorKeybindingMode { fn default() -> Self { - EditorKeybindingMode::Vim // Or EditorKeybindingMode::Default + EditorKeybindingMode::Default } } diff --git a/client/src/functions/modes/navigation/admin_nav.rs b/client/src/functions/modes/navigation/admin_nav.rs index 0612ce3..9b7cc5f 100644 --- a/client/src/functions/modes/navigation/admin_nav.rs +++ b/client/src/functions/modes/navigation/admin_nav.rs @@ -181,6 +181,7 @@ pub fn handle_admin_navigation( } } + // In src/functions/modes/navigation/admin_nav.rs AdminFocus::Button1 => { // Add Logic let mut logic_state_profile_name = "None (Global)".to_string(); let mut selected_table_id: Option = None; @@ -195,7 +196,7 @@ pub fn handle_admin_navigation( selected_table_name_for_logic = Some(table.name.clone()); *command_message = format!("Adding logic for table: {}. CRITICAL: Table ID not found in profile tree response!", table.name); } else { - *command_message = format!("Selected table index {} out of bounds for profile '{}'. Logic will not be table-specific.", t_idx, profile.name); + *command_message = format!("Selected table index {} out of bounds for profile '{}'. Logic will not be table-specific.", t_idx, profile.name); }} else { *command_message = format!("No table selected in profile '{}'. Logic will not be table-specific.", profile.name); } @@ -203,31 +204,20 @@ pub fn handle_admin_navigation( *command_message = "Error: Selected profile index out of bounds, associating with 'None'.".to_string(); } } else { - *command_message = "No profile selected ([*]), associating Logic with 'None (Global)'.".to_string(); - // Keep logic_state_profile_name as "None (Global)" + *command_message = "No profile selected ([*]), associating Logic with 'None (Global)'.".to_string(); + // Keep logic_state_profile_name as "None (Global)" } + // Create AddLogicState with the loaded config admin_state.add_logic_state = AddLogicState { profile_name: logic_state_profile_name.clone(), + editor_keybinding_mode: config.editor.keybinding_mode.clone(), // Add this line ..AddLogicState::default() }; + buffer_state.update_history(AppView::AddLogic); app_state.ui.focus_outside_canvas = false; - // Command message might be overwritten if profile selection had an issue, - // so set the navigation message last if no error. - if !command_message.starts_with("Error:") && !command_message.contains("associating Logic with 'None (Global)'") { - *command_message = format!( - "Navigating to Add Logic for profile '{}'...", - logic_state_profile_name - ); - } else if command_message.contains("associating Logic with 'None (Global)'") { - // Append to existing message - let existing_msg = command_message.clone(); - *command_message = format!( - "{} Navigating to Add Logic...", - existing_msg - ); - } + // Rest of the code remains the same... } AdminFocus::Button2 => { if let Some(p_idx) = admin_state.selected_profile_index {