opencode
opencode copied to clipboard
feat(tui): add double-click to copy word
Summary
Double-click on a word to copy it to clipboard, using the same selection mechanism as drag-to-copy.
Changes
- Detect double-clicks by tracking click time/position (400ms threshold)
- Find word boundaries by scanning the render buffer for word characters
- Create selection using existing
startSelection/updateSelectionAPIs - Existing
onMouseUphandler automatically copies to clipboard with toast notification
Behavior
- Works anywhere drag-to-copy selection works
- Word characters: letters, digits, underscore, hyphen (unicode-aware)
- Respects
OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECTflag
https://github.com/user-attachments/assets/945ce58d-ec9d-4135-b556-896fccfe01b8