From e3ea6800fcd97b3530b3b524faf2bae32ae2957c Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Wed, 2 Dec 2026 05:46:01 -0800 Subject: [PATCH] Type Tools: Make Numbers Sequence's Digits field is unavailable with Leading Zeros off The dialog passes `digits` to the command only while Leading Zeros and Fixed Number of Digits are both on, but the Digits field followed Fixed Number of Digits alone. With Fixed Number of Digits on and Leading Zeros then turned off, Digits still took input that the command never got. Digits now also needs Leading Zeros. Follows #10448. --- crates/ui-egui/src/addons/typetools/numbers.rs | 4 +++- .../src/addons/typetools/numbers/tests.rs | 18 ++++++++++++++++++ docs/mcp.md | 3 ++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/addons/typetools/numbers.rs b/crates/ui-egui/src/addons/typetools/numbers.rs index 68351ad068..250e6788a6 100644 --- a/crates/ui-egui/src/addons/typetools/numbers.rs +++ b/crates/ui-egui/src/addons/typetools/numbers.rs @@ -84,7 +84,9 @@ pub(crate) fn open(app: &mut VectorcraftApp) -> Result { Param::section(tl!("Zeros")), Param::new("leadingZeros", tl!("Leading Zeros"), ParamKind::bool(true)), Param::new("fixedDigits", tl!("Fixed Number of Digits"), ParamKind::bool(false)).enabled_when("leadingZeros", FieldValue::Bool(true)), - Param::new("digits", tl!("Digits:"), ParamKind::int(Some(1), Some(30), 3)).enabled_when("fixedDigits", FieldValue::Bool(true)), + Param::new("digits", tl!("Digits:"), ParamKind::int(Some(1), Some(30), 3)) + .enabled_when("fixedDigits", FieldValue::Bool(true)) + .and_enabled_when_in("leadingZeros", [FieldValue::Bool(true)]), Param::new("trailingZeros", tl!("Trailing Zeros"), ParamKind::bool(false)), Param::new("order", tl!("Order:"), radio(&ORDERS)).enabled_when("shuffle", FieldValue::Bool(false)), Param::new("replace", tl!("Replace:"), radio(&REPLACES)), diff --git a/crates/ui-egui/src/addons/typetools/numbers/tests.rs b/crates/ui-egui/src/addons/typetools/numbers/tests.rs index 79acbf8ef1..bb9f3bcfca 100644 --- a/crates/ui-egui/src/addons/typetools/numbers/tests.rs +++ b/crates/ui-egui/src/addons/typetools/numbers/tests.rs @@ -25,6 +25,24 @@ fn texts(app: &VectorcraftApp, ids: &[u64]) -> Vec { .collect() } +/// Digits takes input only while Leading Zeros and Fixed Number of Digits are both on, since the +/// command gets `digits` only then. +#[test] +fn digits_takes_input_only_with_leading_zeros() { + let (app, _) = app(); + let mut panel = crate::tests::panel_harness::Panel::new(app, crate::tests::picks::dialogs); + open_item(&mut panel.app(), "Type Tools", "Make Numbers Sequence…"); + panel.frame(); + let dialog = dialog_id(&panel.app()); + set(&panel.app(), dialog, "fixedDigits", json!(true)); + panel.frame(); + assert!(panel.enabled("Digits")); + set(&panel.app(), dialog, "leadingZeros", json!(false)); + panel.frame(); + assert!(read(&panel.app(), dialog, super::params).get("digits").is_none()); + assert!(!panel.enabled("Digits"), "with Leading Zeros off the command gets no digits"); +} + /// The dialog's fields reach the command: an end and fixed digits only when turned on, and OK /// numbers the objects as one undo step. #[test] diff --git a/docs/mcp.md b/docs/mcp.md index 27ec011196..461a688cfd 100644 --- a/docs/mcp.md +++ b/docs/mcp.md @@ -18469,7 +18469,8 @@ script. | `removeUnused` | false; true needs `end` | → `{count (objects changed), ids (numbered, in order), removed}`. Make Numbers Sequence… opens a dialog (`ui.menuDialog -{command}`, dialog key `addon.type.numbers`) whose fields are the command's parameters, with Preview. +{command}`, dialog key `addon.type.numbers`) whose fields are the command's parameters, with Preview. Its Digits field takes input only while Leading Zeros +and Fixed Number of Digits are both on. ```json {"name":"run_command","arguments":{"command":"addon.type.numbers","params":{"start":1,"order":"rows"}}}