From 9250f2bfe6b20d74a698e49d292f92b4db9fae3d Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 3 Nov 2026 09:47:07 -0800 Subject: [PATCH] Clear stale Find Font warning after successful replacement --- crates/ui-egui/src/app/commands.rs | 6 ++++++ crates/ui-egui/src/find_font.rs | 12 +++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/crates/ui-egui/src/app/commands.rs b/crates/ui-egui/src/app/commands.rs index 08e7960b3..775248a61 100644 --- a/crates/ui-egui/src/app/commands.rs +++ b/crates/ui-egui/src/app/commands.rs @@ -188,6 +188,12 @@ impl VectorcraftApp { r.insert(0, font.to_string()); r.truncate(MAX_RECENT_FONTS); } + if id == "text.replaceFont" + && v.get("warning").is_none() + && self.ui.status.starts_with("some text is hidden or locked, so its font wasn't replaced") + { + self.ui.status.clear(); + } // A command's warning (Rasterize's when an image couldn't be decoded) shows in the // status bar, as a tool preview's does. if let Some(w) = v.get("warning").and_then(Value::as_str) { diff --git a/crates/ui-egui/src/find_font.rs b/crates/ui-egui/src/find_font.rs index af9a83af0..588869226 100644 --- a/crates/ui-egui/src/find_font.rs +++ b/crates/ui-egui/src/find_font.rs @@ -286,7 +286,7 @@ mod tests { /// Change All leaves locked text in its font, and the status bar says so. #[test] - fn change_all_says_when_locked_text_keeps_its_font() { + fn change_all_clears_the_skip_warning_after_unlocking_text() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); app.session.execute("file.new", &json!({"width": 100, "height": 100})).unwrap(); app.session.execute("text.create", &json!({"x": 10, "y": 40, "text": "Hi", "font": "Missing Family"})).unwrap(); @@ -298,6 +298,16 @@ mod tests { assert_eq!(r["runs"], 0, "{r}"); assert_eq!(fonts(&mut app)[0]["family"], "Missing Family"); assert_eq!(app.ui.status, "some text is hidden or locked, so its font wasn't replaced"); + app.run("object.unlockAll", json!({})).unwrap(); + assert_eq!(app.ui.status, "some text is hidden or locked, so its font wasn't replaced"); + let r = change(&mut app, &d, &from, true).unwrap(); + assert_eq!(r["runs"], 1, "{r}"); + assert!(r.get("warning").is_none(), "{r}"); + assert_eq!(app.ui.status, ""); + app.ui.status = "Saved another document".into(); + let r = app.run("text.replaceFont", json!({"from": {"family": "Missing Family"}, "to": {"family": "Source Sans 3"}})).unwrap(); + assert_eq!(r["runs"], 0, "{r}"); + assert_eq!(app.ui.status, "Saved another document"); } #[test]