From 592ad486db83fc03da4ff4f58be431d2adbb0688 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Sat, 28 Nov 2026 13:09:52 -0800 Subject: [PATCH] Links: a Show filter that hides every image titles the panel No matching images Show Missing or another filter can leave the list empty while the document still holds images, and the empty panel said "No images". The filtered empty state now says "No matching images"; Show All keeps "No images". --- crates/ui-egui/src/panels/links.rs | 11 ++++++----- crates/ui-egui/src/panels/tests_links.rs | 14 ++++++++++++++ 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/crates/ui-egui/src/panels/links.rs b/crates/ui-egui/src/panels/links.rs index 7bb641fe84..ba3723a24e 100644 --- a/crates/ui-egui/src/panels/links.rs +++ b/crates/ui-egui/src/panels/links.rs @@ -786,14 +786,15 @@ pub fn show(app: &mut VectorcraftApp, ui: &mut Ui) { }); }) .show(ui, |ui, _| { - // With no rows the body says how to bring an image in, as the other panels' empty states do. + // With no rows the body says how to bring an image in, as the other panels' empty states do; + // under a Show filter the document can still hold images that the filter hides. if row_ids.is_empty() { - let detail = if o.show == "all" { - tl!("File › Place… brings in an image, linked or embedded.") + let (title, detail) = if o.show == "all" { + (tl!("No images"), tl!("File › Place… brings in an image, linked or embedded.")) } else { - tl!("Nothing matches the Show filter.") + (tl!("No matching images"), tl!("Nothing matches the Show filter.")) }; - super::empty_state(ui, "link", tl!("No images"), detail); + super::empty_state(ui, "link", title, detail); return; } let mut list = List::::new(tl!("Links")).selection(Bind::bound(&mut selection)).row_menu(); diff --git a/crates/ui-egui/src/panels/tests_links.rs b/crates/ui-egui/src/panels/tests_links.rs index e1a60e1c45..e817ac9f36 100644 --- a/crates/ui-egui/src/panels/tests_links.rs +++ b/crates/ui-egui/src/panels/tests_links.rs @@ -203,6 +203,20 @@ fn opening_the_panel_on_the_selected_image_leaves_another_document_alone() { assert_eq!(h.state().ui.links.show, None, "the request is dropped"); } +/// A Show filter that hides every image titles the empty panel "No matching images", since the +/// document still holds images; "No images" stays for a document with none. +#[test] +fn a_filter_that_hides_every_image_says_no_matching_images() { + let dir = Folder::new("empty-filter-title"); + let (app, _, _) = app(&dir); + let mut h = rig(app); + command(&mut h, "ui.links.show", json!({"show": "missing"})); + assert!(shown(&h, "No matching images"), "Show Missing with nothing missing"); + assert!(!shown(&h, "No images"), "the document holds two images"); + command(&mut h, "ui.links.show", json!({"show": "all"})); + assert!(shown(&h, "linked.png") && !shown(&h, "No matching images"), "Show All lists the rows"); +} + /// A frame that fetches nothing keeps the stored rows and Link Info as they are, without a copy; the /// two-second recheck, another first selected image and an edit each store a new cache. #[test]