mirror of
https://github.com/anomalyco/opentui.git
synced 2026-04-24 20:45:56 +03:00
[PR #736] [MERGED] fix(renderer): add OSC 8 hyperlink id parameter and onChunks hook for link detection #1531
Labels
No labels
bug
core
documentation
feature
good first issue
help wanted
pull-request
question
react
solid
tmux
windows
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/opentui#1531
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/anomalyco/opentui/pull/736
Author: @mugnimaestra
Created: 2/24/2026
Status: ✅ Merged
Merged: 3/1/2026
Merged by: @kommander
Base:
main← Head:fix/osc8-hyperlink-id📝 Commits (3)
8dd41d7fix(renderer): add id parameter to OSC 8 hyperlink sequences71e8d29feat(code): add onChunks hook and detectLinks helper for link detection875db41Merge branch 'main' into fix/osc8-hyperlink-id📊 Changes
6 files changed (+247 additions, -5 deletions)
View changed files
➕
packages/core/src/lib/detect-links.test.ts(+98 -0)➕
packages/core/src/lib/detect-links.ts(+56 -0)📝
packages/core/src/lib/index.ts(+1 -0)📝
packages/core/src/renderables/Code.ts(+34 -1)📝
packages/core/src/zig/renderer.zig(+2 -2)📝
packages/core/src/zig/tests/renderer_test.zig(+56 -2)📄 Description
Summary
Fixes hyperlinks not working correctly when they wrap across terminal lines, and adds opt-in link detection for tree-sitter rendered code blocks.
Closes #735
Changes
1.
fix(renderer): add id parameter to OSC 8 hyperlink sequencesThe renderer emitted OSC 8 without the
idparameter, so terminals could not identify wrapped link segments as the same hyperlink. Now emits:Links stay open across row boundaries and close naturally when a different link (or no link) is encountered.
2.
feat(code): add onChunks hook and detectLinks helperThe tree-sitter path (
CodeRenderable) never setlinkonTextChunkobjects, so OSC 8 was never emitted for code blocks.Following maintainer feedback, this uses hooks instead of hardcoded scope names:
onChunkscallback onCodeRenderable— runs aftertreeSitterToTextChunks, beforesetStyledTextdetectLinks()exported helper — scans highlights for URL scopes, setschunk.link = { url }on matchesUses
content.indexOf()to find chunk positions in original content, handling concealed markdown syntax where visible text length differs from source byte positions.Tests
detectLinksincluding concealed text edge caseKnown Limitation
Visual hover highlighting covers one row at a time for wrapped links. The OSC 8 spec defines
id-based cross-row grouping, but no terminal has been verified to implement it. Cmd/Ctrl+Click works correctly across all rows.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.