-
Notifications
You must be signed in to change notification settings - Fork 11.2k
Description
Description
After selecting text by click-dragging (copy-on-select mode on Linux/macOS), the text is copied and the toast notification shows correctly. However, immediately trying to select more text often fails -- the selection doesn't start. You have to wait a bit before text selection works again.
The root cause is in Selection.copy() (selection.ts): it calls renderer.clearSelection() synchronously inside the onMouseUp handler, which runs during @opentui's processMouseEvent event bubbling -- before finishSelection() gets to execute. This nullifies currentSelection before the renderer can properly complete its selection lifecycle (setting isDragging=false, emitting the selection event), leaving stale internal state that blocks subsequent selections.
Plugins
None
OpenCode version
latest (dev)
Steps to reproduce
- Open OpenCode TUI on Linux or macOS (copy-on-select is enabled by default)
- Click-drag to select some text -- it copies and shows "Copied to clipboard" toast
- Immediately try to click-drag to select more text
- The selection often doesn't start on the first attempt
- Wait a moment, then try again -- it works
Operating System
Linux
Terminal
Various (not terminal-specific)