Skip to content

Loss of select ability (copy/paste) shortly after it was working - VSCode #62675

Closed as duplicate

Description

@old-square-eyes

Describe the bug
When running OpenCode inside the VS Code integrated terminal (over SSH), OpenCode text selection works normally at first. However, after performing a few copy-paste operations, the terminal completely loses the ability to select text. The mouse events get captured/locked by the TUI, forcing the user to either manually type reset or permanently disable mouse mode.

There are many copy/paste bugs, but they mostly are for 1.x version and most seem to get closed off. Clearly it's still tormenting users though. The whole reason I use VSCode terminal is primarily because it supports native copy actions, unlike MacOS terminal over SSH, which effectively also rules out pain free copy/paste.

Expected behaviour
Native terminal text selection should remain stable and usable for sustained sessions without desynchronising or requiring a terminal reset.

Root Cause Analysis
The issue stems from an aggressive mouse capture hook within the text input framework. After a few paste operations, the interface drops focus anchors and fails to send the proper disable mouse tracking (\e[?1000l / \e[?1003l) ANSI sequences back to VS Code. This leaves the terminal permanently stuck in application mouse tracking mode, requiring the user to close and start a new session to restore the ability to even select text.

Plugins

No response

OpenCode version

opencode v2.2.6

Steps to reproduce

Steps to reproduce the behaviour:

  1. Launch OpenCode inside the VS Code integrated terminal with mouse mode enabled.
  2. Select and copy code blocks a few times using OpenCode mouse capture native copying
  3. Paste elsewhere.
  4. Attempt to select text again using standard click-and-drag.
  5. Result: The text highlight refuses to register, as the terminal gets stuck in "application mouse tracking mode."

Screenshot

No response

Operating System

macOS 26.6.2

Terminal

VSCode

Activity

  1. opencodejr commented on Nov 8, 2026

    @opencodejr
    Contributor

    Thanks for the report! I think this is a duplicate of #60602, which describes the same setup and symptom: OpenCode v2 in the VS Code terminal on macOS, where selection works at first but stops highlighting anything after a few copies, and only restarting OpenCode fixes it.

    Possible duplicates and closely related issues, ordered from most to least likely:

    The bot will close this issue as a duplicate in 1 day unless you reply explaining how your problem is different. Any extra details are welcome on #60602, for example whether Option+drag (native terminal selection) still works once it gets stuck.

  2. old-square-eyes commented on Nov 8, 2026

    @old-square-eyes
    Author

    Another example... I can't click to accept the ask prompt VERY frequently e.g.

    Image

    Hitting enter works, or restarting a new OpenCode session restores clickable acknowledgement temporarily.

  3. opencodejr commented on Nov 8, 2026

    @opencodejr
    Contributor

    Thanks, that's a useful detail. Clicks on the permission prompt stop working while Enter still does, and only a new session fixes it. That looks like the same problem as the broken selection: after a while the TUI stops handling mouse input until it's restarted. It matches what's already reported in:

    So I still think this is a duplicate. Please add the click symptom to #60602, so all the details are in one place. If you can, also mention whether the clicks stop working only after you've copied something, and whether Option+drag (VS Code's own selection) still works once it's stuck.

    If you think this is a different problem, reply here before the bot closes this issue as a duplicate.

  4. old-square-eyes commented on Nov 8, 2026

    @old-square-eyes
    Author

    60602 is closed - This is an ongoing problem. Tickets get opened, people raise the bug and then you auto close them. People shouldn't have to continually come back and keep their ticket updated just to keep it alive. And it's frustrating being referred to a ticket that has been closed.

  5. old-square-eyes commented on Nov 8, 2026

    @old-square-eyes
    Author

    Here is another manifestation... Select/Copy works but clipboard yeilds only a portion of the content when pasted...

    Image

    Shown here is OpenCode in VSCode in the background with MacOS terminal in the foreground receiving the clipboard "contents". Right after this select stopped working in VSCode OpenCode. Highlighting colours are a bit weird in the source text here. Almost looks like token highlighting.

  6. opencodejr commented on Nov 8, 2026

    @opencodejr
    Contributor

    Thanks for the extra examples, and I understand the frustration with issues being closed automatically.

    #60602 is actually open again: it was reopened after its author answered the questions, and it hasn't been closed since. It's still the issue that matches your main problem: in the VS Code terminal on macOS, selection (and clicking, as you described) stops working after a while, and only restarting OpenCode brings it back. Keeping all the reports in one open issue makes the problem easier to track and fix.

    The partial paste looks like a separate problem. These open issues might cover it:

    If one of them matches (for example, the part that's missing was off-screen when you selected), please add a comment there. If neither does, a separate issue saying what you selected and what you got when you pasted would help. In the meantime, the messages_copy keybind (<leader>y) copies a whole message, and #55294 reports that it copies the text correctly.

    If you think the main problem here is different from #60602, reply before the bot closes this issue as a duplicate.

  7. opencodejr commented on Nov 9, 2026

    @opencodejr
    Contributor

    Closing this as a duplicate of #60602, which is open and covers the same problem: in the VS Code terminal on macOS, mouse selection (and, as you saw, clicking) stops working after a while, and only restarting OpenCode fixes it. Thanks for the extra details. Please add the screenshots and the click symptom to #60602, so everything is tracked in one open issue.

    For the partial pastes, #61053 (a selection can't extend past one screen) and #55294 (mouse copy drops blank lines) are the closest open issues. If neither matches, a separate issue showing what you selected and what was pasted would help.

    If you think this problem is different from #60602, reply here and we can reopen it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions