From 5660a15b7532b37e39a4f6130b894b539279d1a0 Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Tue, 20 Oct 2026 17:46:00 -0700 Subject: [PATCH] Variables: the nothing-applied message clears when a later data set applies After "nothing in data set A was applied: no object is bound to a variable it has a value for" showed in the status bar, choosing a data set that did apply, or stepping to one, left that message in place. `run_now` set the status from a command's `warning` and cleared it only for `file.new`, and the Variables panel test cleared the status by hand before its last check. `dataset.select`, `dataset.next` and `dataset.prev` now clear the status bar when they succeed, and the warning shows when no object is bound to a variable the new data set has a value for. The test no longer clears the status by hand and checks all three commands. --- crates/ui-egui/src/lib.rs | 5 +++++ crates/ui-egui/src/panels/variables.rs | 13 +++++++++++-- 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/lib.rs b/crates/ui-egui/src/lib.rs index 2d4970a12..f0044fe03 100644 --- a/crates/ui-egui/src/lib.rs +++ b/crates/ui-egui/src/lib.rs @@ -807,6 +807,11 @@ impl VectorcraftApp { self.ui.view.pixel_preview = true; } } + // Choosing a data set, or stepping to one, clears the status bar. The reply's `warning` + // below then shows when no object is bound to a variable the data set has a value for. + if matches!(id, "dataset.select" | "dataset.next" | "dataset.prev") { + self.ui.status.clear(); + } if id == "text.setStyle" && let Some(font) = params.get("font").and_then(Value::as_str) { diff --git a/crates/ui-egui/src/panels/variables.rs b/crates/ui-egui/src/panels/variables.rs index ca1fc29f6..4133b488a 100644 --- a/crates/ui-egui/src/panels/variables.rs +++ b/crates/ui-egui/src/panels/variables.rs @@ -392,7 +392,8 @@ mod tests { /// Choosing a data set, or stepping to one with the arrows, shows a status message when no /// object is bound to a variable it has a value for, for example after Import Data Sets… - /// defines new variables. With such an object bound, it shows none. + /// defines new variables. With such an object bound, choosing a data set or stepping to one + /// clears the message. #[test] fn a_data_set_with_nothing_bound_shows_a_status_message() { let mut app = VectorcraftApp::new(vectorcraft_engine::Session::new(), Default::default()); @@ -407,10 +408,18 @@ mod tests { app.run("dataset.prev", json!({})).unwrap(); assert_eq!(app.ui.status, message("A")); - app.ui.status.clear(); app.run("variable.bind", json!({"variable": "Name", "ids": [t]})).unwrap(); app.run("dataset.select", json!({"name": "B"})).unwrap(); assert_eq!(app.ui.status, ""); + // Stepping to a data set that applies clears the message as well. + for step in ["dataset.next", "dataset.prev"] { + app.run("variable.unbind", json!({"variable": "Name", "ids": [t]})).unwrap(); + app.run("dataset.select", json!({"name": "A"})).unwrap(); + assert_eq!(app.ui.status, message("A")); + app.run("variable.bind", json!({"variable": "Name", "ids": [t]})).unwrap(); + app.run(step, json!({})).unwrap(); + assert_eq!(app.ui.status, "", "{step}"); + } } #[test]