opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Feature Request: Make Links Clickable (Ctrl+Left Click to Open)

Open jay-tau opened this issue 5 months ago • 4 comments

It would be very helpful if links (URLs) displayed in opencode were clickable, so that pressing Ctrl+left click on a link would open it in the default browser.

This is a common feature in many editors and terminal applications, and would improve usability when working with URLs in the interface.

Thank you!

jay-tau avatar Jul 20 '25 10:07 jay-tau

Yes, opentui needs to support that. Will be possible soon.

kommander avatar Nov 17 '25 00:11 kommander

It would have to be a OpenTUI library change. (I actually made a POC to see even if it was possible) This is what i found.

OpenTUI Changes:

  1. Add URL matching in the tree-sitter-styled-text.
  2. Register links in a registry to map screen positions to link IDs
  3. On option+leftclick TextBufferRenderable to lookup if theres a link at that position with callback with url

OpenCode Changes:

  1. Open the passed back URL

Here are links to the forked branch POC. I can clean it up if you want me to proceed with the strategy and make a PR, or if you guys were planning on a different way 👍🏼

https://github.com/sst/opencode/compare/dev...thehamsti:opencode:feature/clickable_links?expand=1 https://github.com/sst/opentui/compare/main...thehamsti:opentui:feature/osc8-hyperlinks?expand=1

thehamsti avatar Dec 19 '25 16:12 thehamsti