opencode icon indicating copy to clipboard operation
opencode copied to clipboard

feat(tui): add double-click to copy word

Open ndraiman opened this issue 3 weeks ago • 0 comments

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/updateSelection APIs
  • Existing onMouseUp handler 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_SELECT flag

https://github.com/user-attachments/assets/945ce58d-ec9d-4135-b556-896fccfe01b8

ndraiman avatar Dec 28 '25 08:12 ndraiman