Repository navigation
fix(rune-text): keep inline icons and prefixes on the same line as wrapped URLs - #2498
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Parleyinserts a regular soft wrap opportunity after everyInFlowInlineBox, taking priority overOverflowWrap::BreakWordemergency breaks.SpanBoxspacer) starts a line before an unbroken token wider than the remaining room, Parley breaks immediately after the zero-height box, stranding it on an invisible0 pxline at the sameyas the next line —bare_iconsthen paints the icon up into the previous line, overlapping its text.(in(https://...)) left the opening punctuation orphaned at the end of the previous line.flowchart LR A["PR #66531 ( + [icon] + https://..."] --> B["Cap before '(' prefix"] B --> C["Line N: PR #66531"] B --> D["Line N+1: ( + [icon] + https://..."] D --> E{"wrap_anywhere?"} E -- "true" --> F["LineCap::Chars breaks inside URL within width"] E -- "false" --> G["LineCap::Width keeps prefix + icon + URL together"]Changes
crates/rune-text/src/layout/span.rs,shape.rs,pill_chips.rs: tag bare inline icons withPILL_BAREand extract indices viapill_index.crates/rune-text/src/layout/line_break.rs:logical_prefix_before: keep attached non-whitespace prefixes (e.g.() with their leading inline box in both LTR and RTL.has_label_on_line+orphan_line_fix: when a leadingPILL_BOXorSPAN_BOXstarts a line with zero visible label clusters, break inside the word viaLineCap::Chars(break_next_with_length) underwrap_anywhereor widen viaLineCap::Widthunder normal wrapping.crates/rune-text/src/quality_tests.rs: regression coverage across widths, scales, bidi isolates,wrap_anywhere,pretty, wide boxed pills, and RTL.