SolidCraft: an open-source parametric 3D CAD application built in pure Rust. Desktop, web, and automation through MCP.
Browser: a folder that holds only a new group shows it (#10526) (#10529)
semmelrindebb0b9a1d2fbc
diff --git a/crates/ui-egui/src/browser_cache.rs b/crates/ui-egui/src/browser_cache.rsindex 657343a183..b83b05817a 100644--- a/crates/ui-egui/src/browser_cache.rs+++ b/crates/ui-egui/src/browser_cache.rs@@ -205,7 +205,15 @@ impl Cache {"sketches" => &model.sketches,_ => &model.planes,};- let Some(indices) = indices.get(&component) else { return Folder::default() };+ // A folder that holds only groups (a New Group made before anything is in it) is still+ // drawn, or the group can't be seen or filled (#10526).+ let grouped = doc.browser_groups.iter().any(|g| g.component == component && g.folder == folder);+ let none = Vec::new();+ let indices = match indices.get(&component) {+ Some(indices) => indices,+ None if grouped => &none,+ None => return Folder::default(),+ };let mut all = Vec::with_capacity(indices.len());for i in indices {let entry = match folder {@@ -226,7 +234,7 @@ impl Cache {all.push(entry);}}- if all.is_empty() {+ if all.is_empty() && !grouped {return Folder::default();}let rows = arrange(&doc, component, folder, &prefix, all);diff --git a/crates/ui-egui/src/browser_card_tests.rs b/crates/ui-egui/src/browser_card_tests.rsindex 8071361bff..01cdbf6299 100644--- a/crates/ui-egui/src/browser_card_tests.rs+++ b/crates/ui-egui/src/browser_card_tests.rs@@ -43,6 +43,27 @@ fn clicked_browser_folders_toggle_visibility_with_v() {}}+/// #10526: New Group from the root's context menu in a design with no bodies yet makes a group+/// the Browser shows, and a body made later can be dropped into it.+#[test]+fn a_new_group_in_a_folder_with_nothing_in_it_yet_shows() {+ let mut h = Harness::new();+ h.app.home.open = false;+ h.settle();+ assert!(handle_at("row:Bodies").is_none(), "no bodies, no Bodies folder");+ // What the root's New Group item runs.+ group_action(&mut h.app, "ui.newGroup", &json!({"component": 0}));+ h.settle();+ let group = h.app.session.doc.browser_groups.first().map(|g| (g.id, g.name.clone())).expect("New Group makes a group");+ assert!(handle_at(&format!("row:{} (0)", group.1)).is_some(), "the new group shows in the Browser");+ h.app.run("solid.box", json!({"length":10,"width":10,"height":10,"operation":"new_body","body_name":"One"})).unwrap();+ h.settle();+ h.step(&json!({"drag":[{"handle":"row:One"},{"handle":format!("row:{} (0)", group.1)}]})).unwrap();+ h.settle();+ let items = h.app.session.doc.browser_group(group.0).map(|g| g.items.len()).unwrap_or(0);+ assert_eq!(items, 1, "the body went into the group");+}+/// #10005: F2 on a group picked in the Browser opens its Rename box, as for other rows, and the/// typed name renames the group, at the top level and inside a component; a body selected/// alongside does not take the rename from the clicked group.