[PR #428] [CLOSED] feat: implement osc8 hyperlinks #1310

Closed
opened 2026-03-14 09:29:50 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/anomalyco/opentui/pull/428
Author: @thehamsti
Created: 12/19/2025
Status: Closed

Base: mainHead: feature/osc8-hyperlinks


📝 Commits (2)

  • 33dc7e6 feat: Href parsing, link registry, and making links clickable.
  • 1be11fc Merge branch 'main' into feature/osc8-hyperlinks

📊 Changes

20 files changed (+1055 additions, -24 deletions)

View changed files

📝 packages/core/src/lib/styled-text.ts (+10 -0)
📝 packages/core/src/lib/tree-sitter-styled-text.test.ts (+111 -0)
📝 packages/core/src/lib/tree-sitter-styled-text.ts (+95 -2)
📝 packages/core/src/renderables/TextBufferRenderable.ts (+79 -1)
📝 packages/core/src/renderer.ts (+14 -1)
packages/core/src/tests/hyperlinks.test.ts (+245 -0)
📝 packages/core/src/text-buffer-view.ts (+5 -0)
📝 packages/core/src/text-buffer.ts (+22 -7)
📝 packages/core/src/types.ts (+4 -0)
📝 packages/core/src/zig-structs.ts (+2 -0)
📝 packages/core/src/zig.ts (+44 -1)
📝 packages/core/src/zig/ansi.zig (+24 -0)
📝 packages/core/src/zig/buffer.zig (+33 -9)
📝 packages/core/src/zig/lib.zig (+24 -0)
packages/core/src/zig/link-registry.zig (+147 -0)
📝 packages/core/src/zig/renderer.zig (+45 -1)
📝 packages/core/src/zig/terminal.zig (+18 -0)
📝 packages/core/src/zig/text-buffer-segment.zig (+2 -0)
📝 packages/core/src/zig/text-buffer-view.zig (+36 -0)
📝 packages/core/src/zig/text-buffer.zig (+95 -2)

📄 Description

Changes:

  • Parses hyperlinks with a regex in tree-sitter-styled-text
  • Underlines the hyperlinks (Not sure if this is too opinionated or what style you'd want)
  • Registers the link in a link registry to map screen positions to link IDs
  • On option(alt)+left click in TextBufferRenderable lookup if theres a link at that position with callback with url to app

Possible issues:

  • Styles with underline
  • Pretty limited url parsing regex
  • Just alt? Just ctrl? Alt and ctrl?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/anomalyco/opentui/pull/428 **Author:** [@thehamsti](https://github.com/thehamsti) **Created:** 12/19/2025 **Status:** ❌ Closed **Base:** `main` ← **Head:** `feature/osc8-hyperlinks` --- ### 📝 Commits (2) - [`33dc7e6`](https://github.com/anomalyco/opentui/commit/33dc7e63c31ed20b859f03285a33381ced5c1a3f) feat: Href parsing, link registry, and making links clickable. - [`1be11fc`](https://github.com/anomalyco/opentui/commit/1be11fce516cca25aa6a747cc4c51f1d86cd7882) Merge branch 'main' into feature/osc8-hyperlinks ### 📊 Changes **20 files changed** (+1055 additions, -24 deletions) <details> <summary>View changed files</summary> 📝 `packages/core/src/lib/styled-text.ts` (+10 -0) 📝 `packages/core/src/lib/tree-sitter-styled-text.test.ts` (+111 -0) 📝 `packages/core/src/lib/tree-sitter-styled-text.ts` (+95 -2) 📝 `packages/core/src/renderables/TextBufferRenderable.ts` (+79 -1) 📝 `packages/core/src/renderer.ts` (+14 -1) ➕ `packages/core/src/tests/hyperlinks.test.ts` (+245 -0) 📝 `packages/core/src/text-buffer-view.ts` (+5 -0) 📝 `packages/core/src/text-buffer.ts` (+22 -7) 📝 `packages/core/src/types.ts` (+4 -0) 📝 `packages/core/src/zig-structs.ts` (+2 -0) 📝 `packages/core/src/zig.ts` (+44 -1) 📝 `packages/core/src/zig/ansi.zig` (+24 -0) 📝 `packages/core/src/zig/buffer.zig` (+33 -9) 📝 `packages/core/src/zig/lib.zig` (+24 -0) ➕ `packages/core/src/zig/link-registry.zig` (+147 -0) 📝 `packages/core/src/zig/renderer.zig` (+45 -1) 📝 `packages/core/src/zig/terminal.zig` (+18 -0) 📝 `packages/core/src/zig/text-buffer-segment.zig` (+2 -0) 📝 `packages/core/src/zig/text-buffer-view.zig` (+36 -0) 📝 `packages/core/src/zig/text-buffer.zig` (+95 -2) </details> ### 📄 Description ### Changes: * Parses hyperlinks with a regex in tree-sitter-styled-text * Underlines the hyperlinks (Not sure if this is too opinionated or what style you'd want) * Registers the link in a link registry to map screen positions to link IDs * On option(alt)+left click in TextBufferRenderable lookup if theres a link at that position with callback with url to app ### Possible issues: * Styles with underline * Pretty limited url parsing regex * Just alt? Just ctrl? Alt and ctrl? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-14 09:29:50 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/opentui#1310
No description provided.