fix(tui): keep wrapped markdown links clickable#21559
Open
HaleTom wants to merge 6 commits intoanomalyco:devfrom
Open
fix(tui): keep wrapped markdown links clickable#21559HaleTom wants to merge 6 commits intoanomalyco:devfrom
HaleTom wants to merge 6 commits intoanomalyco:devfrom
Conversation
Wire detectLinks into the non-experimental markdown code path so tree-sitter rendered URLs emit OSC 8 metadata instead of falling back to terminal auto-detection that breaks at line wraps. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
|
The following comment was made by an LLM, it may be inaccurate: Potential Duplicate Found#20400 - fix(tui): enable OSC 8 hyperlink detection for tree-sitter markdown
|
Add PR.md with linked issue/PR strategy learnings and add GAPS.md capturing questions, unexpecteds, and user review queue refs for follow-up decisions. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Remove PR/GAPS tracking docs and add a focused regression test that guards detectLinks wiring in the non-experimental markdown TextPart path. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Replace the source-structure check with a renderer-level behavior test that uses detectLinks and asserts wrapped URL lines preserve one shared link id across the row boundary. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR fixes wrapped markdown URLs becoming unclickable in the TUI by ensuring the non-experimental tree-sitter markdown rendering path attaches OSC 8 hyperlink metadata to URL chunks.
Changes:
- Wire
detectLinksinto the non-experimental markdown<code filetype="markdown">render path in the session UI. - Add a renderer-level regression test that verifies a long URL wraps across multiple rows while retaining a single, stable hyperlink id.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| packages/opencode/src/cli/cmd/tui/routes/session/index.tsx | Adds detectLinks to markdown <code> rendering so URL chunks get OSC 8 hyperlink metadata. |
| packages/opencode/test/cli/tui/markdown-link-wrap.test.ts | Adds a regression test asserting wrapped URL lines preserve a single hyperlink identity across visual wraps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Apply detectLinks to the reasoning markdown path and harden the wrap regression test so renderer cleanup is guaranteed even when assertions fail. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
Extend the renderer-level wrap regression to cover reasoning-shaped markdown content so every render path touched by the review fix has behavior coverage. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This was referenced Apr 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Issue for this PR
Closes #14966
Related: #18394
Overlaps: #20400
Upstream: anomalyco/opentui#735, anomalyco/opentui#736, anomalyco/opentui#737
Type of change
What does this PR do?
Wires
detectLinksinto the non-experimental markdown<code filetype=\"markdown\">path in TUI session rendering.This ensures tree-sitter markdown chunks carry hyperlink metadata so wrapped markdown URLs remain one clickable OSC 8 target instead of relying on terminal auto-detection at visual wraps.
Why use this instead of #20400?
#20400proves the same minimal code path, but it relies on manual verification only.This PR keeps the fix small and in the same location, but adds renderer-level regression coverage for the wrapped-link behavior. The new test renders a super-long file URL through OpenTUI's test renderer, verifies the wrapped lines reconstruct the original URL, and verifies every wrapped line carries the same nonzero hyperlink identity across the row boundary.
That makes this PR safer to merge and maintain because the exact wrap regression now has an automated test instead of depending on a terminal-specific manual check.
How did you verify your code works?
packages/opencode/test/cli/tui/markdown-link-wrap.test.tsbun test --timeout 30000 packages/opencode/test/cli/tui/markdown-link-wrap.test.tsbun typecheckinpackages/opencodeScreenshots / recordings
Not a UI screenshot change.
Checklist