Skip to content

fix(rune-text): keep inline icons and prefixes on the same line as wrapped URLs - #2498

Merged
Hona merged 1 commit into
devfrom
fix/inline-icon-wrap
Nov 26, 2026
Merged

Hona merged 1 commit into
devfrom
fix/inline-icon-wrap

Conversation

@Hona

@Hona Hona commented Nov 26, 2026

Copy link
Copy Markdown
Member

Root cause

  • Parley inserts a regular soft wrap opportunity after every InFlow InlineBox, taking priority over OverflowWrap::BreakWord emergency breaks.
  • When a leading inline box (a link icon, pill chip, or padded SpanBox spacer) starts a line before an unbroken token wider than the remaining room, Parley breaks immediately after the zero-height box, stranding it on an invisible 0 px line at the same y as the next line — bare_icons then paints the icon up into the previous line, overlapping its text.
  • When pushing a split pill or icon to the next line, capping right after attached non-whitespace prefixes (such as ( 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"]
Loading

Changes

  • crates/rune-text/src/layout/span.rs, shape.rs, pill_chips.rs: tag bare inline icons with PILL_BARE and extract indices via pill_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 leading PILL_BOX or SPAN_BOX starts a line with zero visible label clusters, break inside the word via LineCap::Chars (break_next_with_length) under wrap_anywhere or widen via LineCap::Width under normal wrapping.
    • Leave bare inline icons in place once visible label glyphs already share the line.
  • crates/rune-text/src/quality_tests.rs: regression coverage across widths, scales, bidi isolates, wrap_anywhere, pretty, wide boxed pills, and RTL.

@Hona
Hona merged commit 81ec8ec into dev Nov 26, 2026
2 checks passed
@Hona
Hona deleted the fix/inline-icon-wrap branch November 26, 2026 22:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant