TUI: mouse clicks stop working - cannot select text
Author: mrbubble62Created Sep 13, 2026Updated Sep 13, 2026
I am using opencode in a VSCode remote session, the mouse occasionally stops responding, cannot select text or click Approve/Deny Investigation revealed selection stops after a dropped mouse-up (stuck isDragging latch) + focus/mouse-mode desync breaks Shift-drag
- Repro: in a TUI app, drag-select then drop the mouse up (e.g. VSCode remote blip, tmux detach/attach, resize mid‑drag). Result: no further drag‑to‑select works; Shift+drag native selection also breaks in that session.
- Root cause: processSingleMouseEvent gates new selection start on !currentSelection.isDragging (renderer.ts:3684); a lost up leaves isDragging=true forever and the clearSelection() fall‑through (3812) is unreachable. Mouse mode is emitted one‑way and never re‑asserted on focus‑in unless a clean focus‑out preceded it (focusHandler, 3445).
- Expected: state machine self‑heals on the next press; mouse mode re‑syncs on focus‑in.
- Related: #935 (dropped drag → 1‑char selection; complementary, not a fix for this).
Source: anomalyco/opentui