Skip to content

fix(tui): open transcript links on re-clicks inside the double-click window - #56061

Open
Magentai wants to merge 1 commit into
anomalyco:devfrom
Magentai:fix/link-reclick
Open

Magentai wants to merge 1 commit into
anomalyco:devfrom
Magentai:fix/link-reclick

Conversation

@Magentai

@Magentai Magentai commented Oct 16, 2026 •

Copy link
Copy Markdown

Issue for this PR

Closes #56062

Type of change

  • Bug fix

What does this PR do?

clickedLink() required a fresh "cell" selection to treat a mouse release as a link click. That drops two ordinary gestures:

  • a re-click inside OpenTUI's double-click window arrives classified as "word" (further rapid clicks as "line"), because nextClickBehavior() escalates clicks on the same renderable within 500 ms;
  • a pointer that crosses a cell boundary between press and release has isStart cleared, so the release reads as a drag even when it settles back on the link.

Both feel like "the link only opens every other click" in daily use; rapid re-clicks are the worst case, since the click counter stays pinned at "line".

The fix treats a release as a click when the gesture started and ended on the same cell (selection.anchor equals selection.focus). Gestures ending on a different cell still count as selections, so drag selection and copy-on-select keep working. Triple clicks ("line") remain selections. Modified clicks are still left to the terminal.

Trade-off: double-clicking link text now opens the link instead of word-selecting it. Word-selecting inside link text is still possible with a drag; the two gestures are indistinguishable at this layer, and the dropped re-click is the worse UX.

How did you verify your code works?

  • Added a regression test in packages/tui/test/ui/link.test.tsx that uses ManualClock.setTime() to place a re-click deterministically inside the 500 ms window. It fails on dev (opened stays [url]) and passes with this change.
  • Updated the existing repeated-click expectations in that test, which documented the old behavior of silently ignoring the re-click.
  • bun test test/ui/ in packages/tui: 28 pass, 0 fail.

Screenshots / recordings

Mouse behavior change in the terminal, nothing visible to screenshot.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

…window

clickedLink() required a fresh "cell" selection, so a re-click inside
opentui's 500 ms double-click window (classified as "word") silently
did nothing, and a pointer that crossed a cell boundary between press
and release was treated as a drag selection even when it settled back
on the link. Treat any gesture that starts and ends on the same cell
as a click; gestures that end elsewhere stay selections, and triple
clicks remain line selections.
@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for your contribution!

This PR doesn't have a linked issue. All PRs must reference an existing issue.

Please:

  1. Open an issue describing the bug/feature (if one doesn't exist)
  2. Add Fixes #<number> or Closes #<number> to this PR description

See CONTRIBUTING.md for details.

@github-actions

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The fix works. Running OpenCode from source with a simulated response that contains a link, a re-click within 150 ms of the previous click opened the link with this PR (3 opens) but not on the base (2 opens). The updated link.test.tsx passes here and fails against the base, and typecheck for packages/tui passes.

Public API: unchanged (the change is internal to the TUI's clickedLink).

Two non-blocking notes:

  • The third and later clicks in a fast series are still "line" selections, so they still do nothing. Hammering a link quickly therefore still drops most clicks, which is part of the problem the description lists.
  • #55661 moves this same gate into a shared isPlainClick() in packages/tui/src/ui/click.ts (keeping the old isStart && behavior === "cell" check) and reuses it for prompt footer clicks. Whichever lands second will need to carry this logic over, either into that helper or kept specific to links if footer clicks should stay strict.

@github-actions github-actions Bot removed needs:compliance This means the issue will auto-close after 2 hours. needs:issue labels Oct 16, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

This branch has not been deployed

No deployments
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.

Transcript links open only every other click: re-clicks inside the double-click window are silently dropped

1 participant