From 780313c2ffeff057223d4b9bb3691a80b6a01a55 Mon Sep 17 00:00:00 2001 From: Martin Ball Date: Wed, 18 Nov 2026 23:35:52 +0000 Subject: [PATCH] rf-widgets: the match-highlight row story's excerpt has no edge ellipses, which take the paragraph's direction under right-to-left; DIAG removed --- crates/ui-contract/src/testing/suite/variants.rs | 1 - crates/ui-widgets/src/list/row/show.rs | 10 ---------- crates/ui-widgets/src/list/stories.rs | 7 ++++++- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/crates/ui-contract/src/testing/suite/variants.rs b/crates/ui-contract/src/testing/suite/variants.rs index e585ed2ef..a2b9a2caa 100644 --- a/crates/ui-contract/src/testing/suite/variants.rs +++ b/crates/ui-contract/src/testing/suite/variants.rs @@ -165,7 +165,6 @@ fn rtl_from(story: &Story, ltr: &Fixture) -> Result<(), String> { let rtl = shown_in(story, Direction::Rtl); let own = (root_target(ltr).rect, root_target(&rtl).rect); if (own.0.width() - own.1.width()).abs() > 0.5 { - eprintln!("DIAG rf-widgets rtl: {}: ltr rect {:?} rtl rect {:?}", story.name, own.0, own.1); return Err(format!("{}: the component's width differs between directions", story.name)); } // Each node is reflected within the component's own rect, then carried to the component's rect in the other diff --git a/crates/ui-widgets/src/list/row/show.rs b/crates/ui-widgets/src/list/row/show.rs index e48132834..bf32b3682 100644 --- a/crates/ui-widgets/src/list/row/show.rs +++ b/crates/ui-widgets/src/list/row/show.rs @@ -162,16 +162,6 @@ impl Component for ListRow<'_> { }; let label = label.max(self.below_width(sizes)); let own = probe.ideal_width - sizes.min_label + label.max(sizes.min_label) + self.indent_full(sizes); - if !self.label_spans.is_empty() { - let spans = cx.layout(&self.label_run(cx.resolved.label).role(cx.style.text.role)).size().x; - let plain = cx.layout(&TextRun::new(cx.resolved.label).role(cx.style.text.role)).size().x; - let pieces: Vec = - self.label_spans.iter().map(|span| cx.layout(&TextRun::new(span.text.as_ref()).role(cx.style.text.role)).size().x).collect(); - eprintln!( - "DIAG rf-widgets list_row_match_highlight: rtl {rtl} proposal {:?} room {:?} spans {spans} plain {plain} pieces {pieces:?} label {label} ideal {} min {} own {own}", - cx.proposal, cx.room, probe.ideal_width, probe.min_width - ); - } if cx.proposal == Proposal::Ideal { self.report_cell_widths(cx, own); } diff --git a/crates/ui-widgets/src/list/stories.rs b/crates/ui-widgets/src/list/stories.rs index f58fd96c1..bf2509781 100644 --- a/crates/ui-widgets/src/list/stories.rs +++ b/crates/ui-widgets/src/list/stories.rs @@ -42,9 +42,14 @@ fn list_row_text_cell(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { } /// A search result: the match in the label reads in the highlight look. +/// +/// The excerpt neither starts nor ends with a neutral character such as "…": in a right-to-left paragraph a neutral +/// at the paragraph's edge next to left-to-right text takes the paragraph's direction (UAX #9 N1/N2), so it is shaped +/// apart from the letter beside it and the run's width changes by direction, which the suite's right-to-left case +/// rejects. #[story(ListRow<'static>, covers = [], drive = Drive::Never)] fn list_row_match_highlight(ui: &mut Ui, _: &mut StoryData) -> StoryOutput { - let spans = vec![Span::new("…the light over the "), Span::new("harbour").highlight(), Span::new(" turned grey…")]; + let spans = vec![Span::new("the light over the "), Span::new("harbour").highlight(), Span::new(" turned grey")]; let joined: String = spans.iter().map(|span| span.text.as_ref()).collect(); show_as_only_item(ui, ListRow::new(joined).label_spans(spans).detail("Page 4")).into() }