canvas now working properly well

This commit is contained in:
filipriec
2025-04-17 15:40:07 +02:00
parent e921862a7f
commit ff8b4eb0f6
4 changed files with 38 additions and 21 deletions

View File

@@ -198,31 +198,32 @@ pub fn handle_add_table_navigation(
add_table_state.current_focus = new_focus;
*command_message = format!("Focus set to {:?}", add_table_state.current_focus);
// --- THIS IS THE KEY PART ---
// Check if the *new* focus target is one of the canvas input fields
let new_is_canvas_input_focus = matches!(new_focus,
AddTableFocus::InputTableName | AddTableFocus::InputColumnName | AddTableFocus::InputColumnType
);
app_state.ui.focus_outside_canvas = !new_is_canvas_input_focus;
// Set focus_outside_canvas based on whether the new focus is NOT an input field
app_state.ui.focus_outside_canvas = !new_is_canvas_input_focus; // <--- Sets the flag correctly
// --- END KEY PART ---
// Select first item when focusing a table
match add_table_state.current_focus {
AddTableFocus::ColumnsTable if add_table_state.column_table_state.selected().is_none() && !add_table_state.columns.is_empty() => {
add_table_state.column_table_state.select(Some(0));
add_table_state.column_table_state.select(Some(0));
}
AddTableFocus::IndexesTable if add_table_state.index_table_state.selected().is_none() && !add_table_state.indexes.is_empty() => {
add_table_state.index_table_state.select(Some(0));
add_table_state.index_table_state.select(Some(0));
}
AddTableFocus::LinksTable if add_table_state.link_table_state.selected().is_none() && !add_table_state.links.is_empty() => {
add_table_state.link_table_state.select(Some(0));
}
_ => {}
AddTableFocus::LinksTable if add_table_state.link_table_state.selected().is_none() && !add_table_state.links.is_empty() => {
add_table_state.link_table_state.select(Some(0));
}_ => {}
}
} else if !handled {
// If not handled by this specific navigation, clear the message potentially set by get_general_action
// command_message.clear(); // Optional: depends if you want default messages
// ...
}
handled
}