mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 04:27:49 +00:00
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
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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<f32> =
|
||||
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);
|
||||
}
|
||||
|
||||
@@ -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()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user