From 2fa69d40d89c96505e25e1eb406f120f7a5f9bc4 Mon Sep 17 00:00:00 2001 From: aiongg Date: Sat, 14 Nov 2026 15:52:06 +0000 Subject: [PATCH] panels-w13: repair 1 --- crates/text/src/ui/character/rows.rs | 3 ++- crates/text/src/ui/character/stories.rs | 4 ++-- crates/text/src/ui/character/style_options.rs | 9 +++++---- crates/text/src/ui/style_panel.rs | 20 +++++++++---------- crates/text/tests/it/main.rs | 2 +- 5 files changed, 20 insertions(+), 18 deletions(-) diff --git a/crates/text/src/ui/character/rows.rs b/crates/text/src/ui/character/rows.rs index a3156965f..caef11ff6 100644 --- a/crates/text/src/ui/character/rows.rs +++ b/crates/text/src/ui/character/rows.rs @@ -56,7 +56,8 @@ impl Lengths<'_> { let LengthRow { label, side, value, range, presets } = spec; let points = value.map_or(Mixed::Mixed, |value| Mixed::Same(Some(f64::from(value)))); let field = Field::new(label.clone()).side(side).show(ui, |ui, _| { - let out = length_field(self.unit, label.clone(), points, range.clone()).presets(presets).scrub_by_label().sizing(Sizing::FillWidth).show(ui); + let out = + length_field(self.unit, label.clone(), points, range.clone()).presets(presets).scrub_by_label().sizing(Sizing::FillWidth).show(ui); (out.edit.events, out.preset) }); field.inner.unwrap_or_default() diff --git a/crates/text/src/ui/character/stories.rs b/crates/text/src/ui/character/stories.rs index d5920c3b3..5a845053c 100644 --- a/crates/text/src/ui/character/stories.rs +++ b/crates/text/src/ui/character/stories.rs @@ -1,11 +1,11 @@ //! Stories of the Character and Paragraph controls, the Paragraph dialog and its preview. +#[cfg(feature = "font-picker")] +use super::FaceAxes; use super::{ BaselinePosition, Caps, CharacterControls, CharacterValues, Kerning, Leading, LineSpacing, ParagraphAlign, ParagraphControls, ParagraphDialog, ParagraphFormat, ParagraphPreview, ParagraphValues, SpacingKind, SpecialIndent, TextAlign, }; -#[cfg(feature = "font-picker")] -use super::FaceAxes; use craft_theme::Rgba; use craft_ui::contract::Show as _; use craft_ui::dialog::{DialogStack, StackDialog as _}; diff --git a/crates/text/src/ui/character/style_options.rs b/crates/text/src/ui/character/style_options.rs index 8bda4934d..8d8ed314f 100644 --- a/crates/text/src/ui/character/style_options.rs +++ b/crates/text/src/ui/character/style_options.rs @@ -323,7 +323,8 @@ impl<'a> TextStyleOptions<'a> { found }), StyleAttribute::Size => include_row(ui, &words.include, attribute, on, |ui| { - let row = LengthRow { label: cw.size.clone(), side: text_side(&cw.size), value: c.size, range: SIZE_RANGE, presets: &size_presets }; + let row = + LengthRow { label: cw.size.clone(), side: text_side(&cw.size), value: c.size, range: SIZE_RANGE, presets: &size_presets }; let (event, _) = lengths.row(ui, row); character(number_change(event, CharacterChange::Size)) }), @@ -363,9 +364,9 @@ impl<'a> TextStyleOptions<'a> { } Vec::new() }), - StyleAttribute::FauxBold => { - include_row(ui, &words.include, attribute, on, |ui| toggle_field(ui, &cw.faux_bold, "text_bold", c.faux_bold, CharacterChange::FauxBold)) - } + StyleAttribute::FauxBold => include_row(ui, &words.include, attribute, on, |ui| { + toggle_field(ui, &cw.faux_bold, "text_bold", c.faux_bold, CharacterChange::FauxBold) + }), StyleAttribute::FauxItalic => include_row(ui, &words.include, attribute, on, |ui| { toggle_field(ui, &cw.faux_italic, "text_italic", c.faux_italic, CharacterChange::FauxItalic) }), diff --git a/crates/text/src/ui/style_panel.rs b/crates/text/src/ui/style_panel.rs index b31f30246..211e047ce 100644 --- a/crates/text/src/ui/style_panel.rs +++ b/crates/text/src/ui/style_panel.rs @@ -397,16 +397,16 @@ impl<'a> TextStylesPanel<'a> { None => list, }; let shown_rows = list.show_items(ui, &source, &mut |id, _| { - let Some(row) = rows.iter().find(|row| row.id == *id) else { return ListRow::new(Label::Empty) }; - let is_current = target && current == Some(*id); - let marked = is_current && overridden; - let none = *id == 0 && !paragraph; - let name = if marked { words.overridden_name.fill(&[("name", row.name.as_str())]) } else { row.name.clone() }; - let spoken = if marked { words.overridden_spoken.fill(&[("name", row.name.as_str())]) } else { row.name.clone() }; - let description = if none { words.no_character_style.as_str().to_owned() } else { tip.clone() }; - let styled = ListRow::new(name).accessible_name(spoken).description(description).highlight(is_current); - if none { styled.ink(RowInk::Dimmed) } else { styled } - }); + let Some(row) = rows.iter().find(|row| row.id == *id) else { return ListRow::new(Label::Empty) }; + let is_current = target && current == Some(*id); + let marked = is_current && overridden; + let none = *id == 0 && !paragraph; + let name = if marked { words.overridden_name.fill(&[("name", row.name.as_str())]) } else { row.name.clone() }; + let spoken = if marked { words.overridden_spoken.fill(&[("name", row.name.as_str())]) } else { row.name.clone() }; + let description = if none { words.no_character_style.as_str().to_owned() } else { tip.clone() }; + let styled = ListRow::new(name).accessible_name(spoken).description(description).highlight(is_current); + if none { styled.ink(RowInk::Dimmed) } else { styled } + }); let (events, second) = (shown_rows.events, shown_rows.activation_clicks >= 2); let pointer = craft_ui::runtime::pointer::frame(ui.ctx()); diff --git a/crates/text/tests/it/main.rs b/crates/text/tests/it/main.rs index 6eb27fa9c..efb41a8c7 100644 --- a/crates/text/tests/it/main.rs +++ b/crates/text/tests/it/main.rs @@ -4,7 +4,7 @@ mod editor; mod notes; -mod path_text; +// PLAN: `mod path_text;` belongs here once tools-w4's `tests/it/path_text.rs` exists. It is not in this tree, so the declaration fails to compile. mod ruler; mod style_options; mod style_panel;