anomalyco / anomalyco/opencode

TUI copy should preserve logical text instead of rendered layout

Open
#47,165 2 comments 1 reaction 1 assignee View on GitHub

@kommander is already working on this.

Since Sep 3, 2026.

Dominant language
TypeScript
Stars
209k
Forks
27.5k
PR merge metrics
PR metrics pending

Description

Description

When OpenCode runs over direct SSH in macOS Terminal, enabling mouse reporting lets the TUI capture drag selection, but its copy action reports success, while the local clipboard remains unchanged.

I feel this feature has some use but really seeks to browser-fi an inherently mouse-less solution that a TUI /CLI should be. That would be fine if we had a choice. Instead I'm stuck with this over-engineered, unworkable solution.

Disabling mouse reporting in macOS terminal (under "View" menu) restores normal terminal copy/paste, but then copying assistant code blocks captures the rendered terminal layout rather than the source text. Visual wrapping becomes literal newlines, and sidebar/gutter content and whitespace is included in the clipboard. A command displayed as one logical shell line comes with new lines and unwanted artefacts, therefore pastes as multiple commands and fails.

This makes copy/paste unusable for normal terminal-first use for any wrapped lines.

Please provide keyboard-first copy actions for assistant messages and code blocks that copy the underlying logical text, independent of display wrapping and layout. Mouse interception should be optional rather than required for correct copying. For users that want it... please look at supporting, first-class over-ssh usage.

Plugins

No response

OpenCode version

No response

Steps to reproduce

Fail mode #1 - Log into host via ssh, start opencode, use drag-copy, fail to have clipboard populated.
Fail mode #2 - Turn off mouse reporting in macOS terminal (under "View" menu), try to copy any multiple line agent output, loose your mind reconstructing/reformatting it after you have pasted it to your intended destination (especially if that destination is another CLI).

Screenshot and/or share link

No response

Operating System

No response

Terminal

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.