GeezerVison is showing github.com — Cannot select text in chat messages - mouse capture stuck in prompt field ( VSCode terminal) · Issue #15212 · anomalyco/opencode
Cannot select text in chat messages - mouse capture stuck in prompt field ( VSCode terminal) #15212DescriptionDescription
Description
Text selection in the chat area is broken when running OpenCode in the VS Code integrated terminal. The mouse cannot select text in assistant or user messages. It appears the prompt input field captures all mouse events and does not release them to the chat area.
Observed behavior
- After starting OpenCode, mouse selection in the chat area never works initially
- The problem returns every time OpenCode is (re)started, including after restarting VS Code
- Certain actions can "unlock" selection, but not all are consistent:
- Most reliable workaround: Click on a previous user prompt in the chat, then press
Esc — this releases mouse capture and selection starts working
- Switching the VS Code color theme (which triggers a terminal re-render) also works
- Clicking outside VS Code and back sometimes works
- Sending a question/response sometimes works, but not always
- Once selection starts working, it appears to stay working for the rest of the session
- The environment variable
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true does not help
Best workaround found
Click on any previous user message in the chat (which opens "Message actions"), then press Esc. This releases the mouse capture and enables text selection for the remainder of the session.
Root cause hypothesis
The prompt input field claims exclusive mouse capture at startup, preventing normal mouse selection in the chat area. Actions that trigger a focus cycle (clicking a message + Esc, theme switch, window focus loss/gain) reset this capture state. The bug is in the initial mouse capture state of the TUI — it is set too aggressively at startup and not properly scoped to the prompt input area only.
My Environment
- OpenCode version: 1.2.15
- OS: Windows 11
- Terminal: VS Code integrated terminal (PowerShell)
- VS Code version: latest
Related issues
Steps to reproduce
- Open VS Code
- Start OpenCode in the integrated terminal
- Send a message and wait for a response
- Try to select text in the assistant's response with the mouse
- Result: Selection does not work — the mouse has no effect in the chat area
- Now click on your previous user message in the chat (the "Message actions" dialog appears)
- Press
Esc to close the dialog
- Try selecting text in the chat again
- Result: Selection now works and continues working for the rest of the session
Reacted by Shubham Dhama, Dan Brown, Francesc Rosas, Vwings, Davide Bizzarri, Mark Gibson and DarknessChaser Activityjjnxpct commented on Feb 26, 2026 Additional finding: The selection issue does NOT occur when running OpenCode in Windows Terminal (standalone). It only occurs in VS Code's integrated terminal. This confirms the root cause is in how the TUI interacts with VS Code's terminal mouse handling, not in OpenCode's TUI itself.
Workaround: Run OpenCode in Windows Terminal instead of VS Code's integrated terminal, or use the click-previous-prompt + Esc workaround described above. alexzoo commented on Feb 26, 2026 surak commented on Feb 27, 2026 +1 for Mac OS/VSCode. It works as intended on MacOS' terminal. surak commented on Feb 27, 2026 @jjnxpct perhaps you can update the issue's title as it's not exclusive to Windows, but to VSCode. changed the title [-]Cannot select text in chat messages - mouse capture stuck in prompt field (Windows 11 / VS Code terminal)[/-] [+]Cannot select text in chat messages - mouse capture stuck in prompt field ( VSCode terminal)[/+] on Feb 27, 2026kommander commented on Feb 27, 2026 There is no exclusive mouse capture. Might be something odd with how mouse events are triggered. Did it work properly in an earlier version? If so could you identify the version where the issue started happening? You can switch to an explicit version with opencode upgrade [version]. jjnxpct commented on Feb 27, 2026 @kommander Hi! I just started using Open Code so I can't tell when this started happening. Sorry.
As a workaround I now start Open Code in a terminal outside VSC. In this external window I can select (and copy) text OK. So this is related to the use inside VSC. alterdaemon commented on Mar 1, 2026 I confirm the problem occurs also on Linux (Debian).
Can't select and copy TUI chat text.
Sometimes (hard to determine when exactly) it works fine within vscode main window integrated terminal but it never works properly when vscode integrated terminal pane is moved out into the new vscode window (besides main vscode window) philtomson commented on Mar 27, 2026 Can confirm that this also happens in Fedora 42 when OpenCode (1.3.3) is run in a terminal. Mouse clicking, wheel works for a while and then stops working. Also notice that if I have multiple terminal tabs it effects each tab even the ones where OpenCode is not running. removed bugSomething isn't working opentuiThis relates to changes in v1.0, now that opencode uses opentui on May 3, 2026github-actions commented on Jul 4, 2026 To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|