Re-align Paragraph on resize

Fixes #2888
This commit is contained in:
Héctor Ramón Jiménez 2025-04-12 00:48:57 +02:00
parent 3ee9a1e187
commit d1e936fb25
No known key found for this signature in database
GPG key ID: 7CC46565708259A7

View file

@ -186,7 +186,8 @@ impl core::text::Paragraph for Paragraph {
Some(new_bounds.height), Some(new_bounds.height),
); );
let (min_bounds, _has_rtl) = text::measure(&paragraph.buffer); let min_bounds =
align(&mut paragraph.buffer, &mut font_system, paragraph.align_x);
paragraph.bounds = new_bounds; paragraph.bounds = new_bounds;
paragraph.min_bounds = min_bounds; paragraph.min_bounds = min_bounds;
@ -376,6 +377,8 @@ fn align(
} }
needs_relayout = true; needs_relayout = true;
} else if let Some(line) = buffer.lines.first_mut() {
needs_relayout = line.set_align(None);
} }
} }