Skip to content

Make web addresses in replies clickable - #179

Merged
lydakis merged 3 commits into
mainfrom
claude/project-thread-45hlbm-links
Oct 27, 2026
Merged

lydakis merged 3 commits into
mainfrom
claude/project-thread-45hlbm-links

Conversation

@lydakis

@lydakis lydakis commented Oct 26, 2026 •

Copy link
Copy Markdown
Owner

Clicking a web address in Sonny's conversation didn't open it. Sonny printed the address as plain text, so a click worked only if the terminal found the address on its own. That often fails inside a multiplexer pane, and it always fails once an address wraps onto the next row.

Sonny now marks every address it writes into the scrollback as an OSC 8 hyperlink, which terminals open on a click (Cmd-click in Ghostty and iTerm). If an address is cut at the edge of a row, both parts open the whole address. Punctuation that ends the sentence, such as a closing ., , or ), is left out of the link.

links

The dashed underline in the screenshot is how xterm.js draws a hyperlink. In the screenshot, the second address wraps and both of its rows link to the whole address.

How

Ratatui drops control characters from text, so the escapes can't go in a Span. sonny/src/links.rs instead reads the rows insert_before just drew, finds the addresses, and copies those cells with the hyperlink's opening escape on each address's first cell and the closing escape on its last. draw() then writes only those cells again, through the backend, at the rows they now occupy above the viewport. Cells that have already scrolled off the screen are skipped.

Rows still in the viewport, such as the line that is streaming, get their links once they are written into the scrollback.

Testing

  • Three tests in links.rs cover an address within a row and the punctuation trimmed from its end, an address cut across two rows, and text that has no address. cargo test -p sonny passes (99 + 7), and cargo clippy is clean.
  • Checked live: Sonny ran under script in tmux against a scripted reply with two addresses. The raw output has the three expected OSC 8 links, one per row piece, and the screen reads the same as before.
  • A multiplexer has to pass OSC 8 through to the outer terminal. tmux 3.4+ does this with terminal-features hyperlinks. I haven't checked Herdr or Rex.

Rows written into the scrollback are drawn again over themselves with
an OSC 8 hyperlink around each web address, so a Cmd-click opens it even
where the terminal does not find addresses itself, or where an address
wraps onto the next row. Ratatui drops control characters from text, so
the escapes go on the cells after the rows are drawn.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-27T00:02:37.968662Z 4bc4c81 New commits
🔒 Security Review ✅ Completed 2026-10-27T00:05:42.445363Z 4bc4c81 New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 5389110236

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread sonny/src/links.rs Resolved
Comment thread sonny/src/links.rs Resolved
Comment thread sonny/src/links.rs Resolved
An address was followed into one next row at most, and into any
indented row after an address that happened to end at the edge. The
wrap now marks a row that goes on with a word cut in the row above, and
the links follow an address through every such row, and no others.

An address with a character beyond ASCII, such as `café`, was linked
up to that character, so a click opened another page or host. It is now
left unlinked.

The wrap also gave rows after the first the first row's room, so a
wider indent after it pushed them past the edge, where they were cut.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Claude-Session: https://claude.ai/code/session_01LutDnsMA6fqW8Qwj2Wcoks
@lydakis
lydakis merged commit ecf90f9 into main Oct 27, 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