vim or default mode workin properly now

This commit is contained in:
filipriec
2025-05-24 19:25:35 +02:00
parent 7229e2abbd
commit 82e96f7b86
3 changed files with 9 additions and 21 deletions

View File

@@ -85,8 +85,6 @@ revert = ["r"]
[editor]
keybinding_mode = "vim" # Options: "default", "vim", "emacs"
show_line_numbers = true
tab_width = 4
[colors]
theme = "dark"

View File

@@ -19,7 +19,7 @@ pub enum EditorKeybindingMode {
impl Default for EditorKeybindingMode {
fn default() -> Self {
EditorKeybindingMode::Vim // Or EditorKeybindingMode::Default
EditorKeybindingMode::Default
}
}

View File

@@ -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<i64> = 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 {