Skip to content

fix(tui): give links their own hue and make preview links clickable - #714

Merged
mohitranka merged 1 commit into
mainfrom
fix/preview-links-clickable
Sep 17, 2026
Merged

mohitranka merged 1 commit into
mainfrom
fix/preview-links-clickable

Conversation

@mohitranka

Copy link
Copy Markdown
Contributor

What

Two link defects in the content pane.

Preview links were underlined but unclickable. The Editor tab's Markdown preview rendered through render_markdown, which strips destinations but keeps link_label_style's underline. No destination ever reached the buffer cells, so the link could not be acted on in any terminal.

Links looked like any other underlined run. Link labels rendered as text_primary plus underline — exactly what the footer's focused llm / effort chips look like.

Follow-up to #712, which made bare URLs carry destinations in the transcript.

How

  • set_markdown_preview builds its rows with render_markdown_links (same geometry, destinations kept), and paint_preview_row marks the columns after painting, under a single per-frame hyperlinks_enabled() gate — the same paint-then-mark order and the same gate conversation::paint_row already uses.
  • New link token in ThemePalette, optional in theme files and falling back to info (the neutral-information hue, deliberately outside the accent/status hue invariant) so existing theme drops keep parsing. Forge Dark #4FC9DF, Forge Light #00606E, both AA-checked on canvas/panel/panel_alt.
  • links::link_label_style paints the label with that hue and keeps the underline, so the hue separates a link from every other underlined run while the underline keeps the affordance on terminals that cannot carry colour (§5.4).
  • accent stays out of the label: it means focus, and the footer already underlines its focused chips in it.
  • FORGE-DESIGN.md: link row in the §5 token table, a §6 rule ("an underline on its own never says link") plus a hierarchy row, and the §9 "underline is a promise" bullet rewritten around the hue.

Out of scope on purpose

  • The transcript already emits OSC 8 correctly on every surface (markdown links, bare URLs, prompt URLs, URLs in lists, URLs after non-ASCII); clicking is the terminal's job (⌘-click in Ghostty, ctrl+click on Linux). Nothing in-app opens a browser.
  • Streaming answers and thinking rows still show an underline before the block settles; the destination arrives with the settled render.

Test plan

  • cargo test -p forge-config --locked — 100 passed.
  • cargo test -p forge-tui --locked link 32, markdown 69, theme:: 48, source_viewer 61, user_message_gutter 32 — all green.
  • New coverage: the preview destination survives the widget render and reaches the cells; preview columns are marked only when hyperlinks_enabled() says the terminal renders them; links::tests::a_link_is_not_just_an_underlined_run pins that a link label is neither primary text nor accent.
  • cargo fmt --all -- --check clean; cargo clippy -p forge-tui -p forge-config --all-targets --locked -- -D warnings clean.
  • Manual: cargo build --release --locked --package forge-cli, open a Markdown file, :preview, then ⌘-click (macOS) / ctrl+click (Linux) in Ghostty.

Two link defects in the content pane.

The Markdown preview rendered through `render_markdown`, which strips destinations but keeps the underline, so a link in a previewed file was underlined on every terminal and clickable on none: no destination ever reached the cells. Build the preview through `render_markdown_links` and mark its rows in the same paint-then-mark order and under the same per-frame gate the transcript uses.

Links also rendered as `text_primary` plus underline, which is exactly what the footer's focused chips look like. Add a `link` palette token (falls back to `info`) and paint link labels with it, so the hue separates a link from every other underlined run while the underline keeps the affordance on terminals that cannot carry colour.
@mohitranka
mohitranka merged commit b3a4c0e into main Sep 17, 2026
3 checks 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.

1 participant