GeezerVison is showing github.com — feat(tui): add double/triple click copy selection by timwuhaotian · Pull Request #17465 · anomalyco/opencode
Conversation
Issue for this PR
Closes #3091
Closes #7336
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
This adds mouse word/line copy support to the TUI.
- Double click selects and copies the visible word under the cursor.
- Triple click selects and copies the visible line.
- The copied selection stays highlighted until the next interaction.
The selection is computed from the rendered terminal buffer, so it matches what the user actually sees, including concealed markdown/code and wide characters.
Existing drag-copy and right-click copy behavior stays the same. Clickable TUI elements also skip their normal action while a text selection is active.
How did you verify your code works?
I ran:
bun test test/cli/tui
bun typecheck
I also added TUI tests for:
- single click does not create a custom selection
- concealed markdown/code double click selects the visible word
- wide character double click works from either half of the cell
- triple click selects the full visible line across sibling selectable elements with layout gaps
- existing drag-copy behavior still works
- streak timeout and target changes reset correctly
Screenshots / recordings

Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
If you do not follow this template your PR will be automatically rejected.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
ctf0 and thomasqueirozb reacted with thumbs up emoji
- Added selection utility functions to manage text selection in the TUI.
- Integrated selection checks in various components to prevent actions when text is selected.
- Updated dialog components to handle selection state during user interactions.
- Enhanced mouse event handling to support double and triple click selections.
- Added tests for selection behavior, including single, double, and triple click scenarios.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for updating your PR! It now meets our contributing guidelines. 👍
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
timwuhaotian
changed the title
feat: implement selection and copy functionality in TUI components via double click (word) and triple click (row)
feat(tui): add double/triple click copy selection
Mar 14, 2026
|
Automated PR Cleanup
Thank you for contributing to opencode.
Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.
This PR was closed because it matched the following cleanup criteria:
- The PR was created more than 1 month ago
- The PR had fewer than 2 positive reactions
- Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR
PRs created within the last month are not affected by this cleanup.
If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.
Thanks again for taking the time to contribute.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
@rekram1-node not sure if the original contributor abandoned this but it is very much a desired feature, with many duplicate issues regarding this.
Is it at all possible that this gets reopened/reviewed? I'd be happy to take this PR over if necessary.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|