You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Make OSC 8 file:// terminal hyperlinks clickable (#1617)
* Make OSC 8 file:// terminal hyperlinks clickable
ghostty underlines OSC 8 cells on hover at the renderer level, but the
app's link provider dropped every non-http(s) URI, so file:// links from
agents (Claude Code wraps printed paths via pathToFileURL when
FORCE_HYPERLINK=1 — which dev3 itself sets) had hover affordance and a
dead click. Accept file URIs with an empty/localhost host, convert them
back to a local path (Windows drive form included, trailing :line:col
carried out), and activate through the existing resolveTerminalPaths +
activateTerminalPath flow so the allowed-roots policy and the file-open
setting keep applying.
* Open the OSC 8 link under the cursor, not the cached one
ghostty-web keys its link cache by hyperlink id and gives every OSC 8 link
on screen the same id, answering a hit-test from that cache before it scans
the clicked row. Every link therefore activated whichever one was scanned
first, so the hover tooltip named one file and the click opened another.
Activation now re-resolves the cell under the pointer through shared cell
math, and moves into activateOsc8Uri so the branch is testable: a file URI
that cannot become a path no longer falls through to window.open, and
percent-decoding can no longer re-introduce control characters into the
path. The link suffix parser is bounded and the refusal message names both
reasons a path can fail.
---------
Co-authored-by: h0x91B <h0x91b@gmail.com>
Terminal file paths that agents wrap in OSC 8 file:// hyperlinks (Claude Code does) showed a hover underline but a dead click: the link provider accepted only http(s) URIs. file:// links now Cmd/Ctrl+Click open like plain path links — resolved on the backend against the allowed roots, then previewed or revealed per the "File path click action" setting. Clicking an OSC 8 link also opens the link actually under the cursor: every such link on screen shares one hyperlink id, so the terminal's own link cache used to answer every click with whichever link was hovered first, and the hover tooltip named one file while the click opened another.
0 commit comments