From c3c2b0294ed28ca7d0ae3773dd2938ef70c03f9e Mon Sep 17 00:00:00 2001 From: dotCooCoo Date: Thu, 19 Nov 2026 16:41:48 -0800 Subject: [PATCH] Fields: Tsume reads a percent sign like the other percent fields The Tsume field in Advanced Character Formats shows a % beside it but read its text as a unitless number, so 25% and 50%/2 were rejected with "Tsume must be a number". It now takes the percent field dispatch; the 0 to 100 clamp still applies. --- crates/ui-egui/src/dialogs/char_style_options.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/ui-egui/src/dialogs/char_style_options.rs b/crates/ui-egui/src/dialogs/char_style_options.rs index cf47c85156..f5174d1231 100644 --- a/crates/ui-egui/src/dialogs/char_style_options.rs +++ b/crates/ui-egui/src/dialogs/char_style_options.rs @@ -315,7 +315,7 @@ fn case_from_attrs(attrs: &Map) -> Option<&'static str> { fn typed_number(key: &str, text: &str) -> Option { match key { "size" | "leading" | "baseline_shift" | "tcyUpDown" | "tcyLeftRight" | "stroke_width" => crate::widgets::typed_points(text), - "h_scale" | "v_scale" | "fill_tint" | "stroke_tint" => crate::widgets::typed_number_with(text, "%"), + "h_scale" | "v_scale" | "tsume" | "fill_tint" | "stroke_tint" => crate::widgets::typed_number_with(text, "%"), "rotation" => crate::widgets::typed_number_with(text, "°"), _ => crate::widgets::typed_number(text), } @@ -2017,7 +2017,7 @@ mod tests { assert_eq!(d.fields["tsume"], json!("")); let mut d = dialog_for(json!({"tsume": 50.0})); assert_eq!(d.fields["tsume"], json!(50.0)); - for (typed, kept) in [("0", 0.0), ("25.5", 25.5), ("150", 100.0), ("-5", 0.0)] { + for (typed, kept) in [("0", 0.0), ("25.5", 25.5), ("25%", 25.0), ("50%/2", 25.0), ("150", 100.0), ("-5", 0.0)] { d.fields.insert("tsume".into(), json!(typed)); assert_eq!(edited_attrs(&d).unwrap(), attrs(json!({"tsume": kept})), "{typed}"); }