Skip to content

Comments

Add leading and trailing icon link decorations#50

Merged
bjdodson-openai merged 5 commits intomainfrom
bjd/link-icons
Jan 21, 2026
Merged

Add leading and trailing icon link decorations#50
bjdodson-openai merged 5 commits intomainfrom
bjd/link-icons

Conversation

@bjdodson-openai
Copy link

@bjdodson-openai bjdodson-openai commented Jan 21, 2026

Summary

Add inline icon support to LinkDecoration (Painter + Composable) so links can render leading/trailing icons inline with text while preserving line‑wrap and underline behavior.
Updates the Markdown demo to showcase the new capability.

References: follow‑up to LinkDecoration groundwork in #49

Changes

  • LinkDecoration now accepts inlineContent via LinkInlineContent (leading/trailing + spacing + hit target).
  • New InlineIconSpec sealed type with:
    • Painter (fast path for icons)
    • Composable (escape hatch for custom content)
  • New LinkContext and LinkComposableContent fun interface for composable content.
  • RichTextString now resolves link decorations into ranges that include link text.
  • Text builds a decorated AnnotatedString with inline placeholders and adjusts underline ranges accordingly.
  • Markdown demo shows a trailing arrow icon for dotted links.

Behavior

  • Icons are inserted inline as placeholders, so they wrap naturally.
  • Underline drawing still respects line wrapping and excludes icons (underline stays on link text).
  • Optional includeInHitTarget expands link tap area to include the icons.

RTL / Layout

  • Inline icons follow logical leading/trailing order, so they appear before/after the text in RTL appropriately.
  • Spacing uses start/end padding to respect layout direction.

Testing

image

Notes

  • LinkDecoration.matcher already supports (destination, text) so icon insertion can be context‑aware.
  • This is a middle‑ground API: efficient for common icon use cases while still allowing custom composables.

Codex

Prompt/context: “Add leading/trailing icon support to LinkDecoration using a middle‑ground API (Painter + Composable), integrate inline placeholders into Text so icons wrap with link
text, keep underline drawing correct, and update the Markdown demo with an example.”

@bjdodson-openai bjdodson-openai merged commit c0d4557 into main Jan 21, 2026
1 check passed
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.

2 participants