[feat] support to select the assistant's output text with the mouse #210

Closed
opened 2026-02-16 17:25:46 -05:00 by yindo · 5 comments
Owner

Originally created by @douglarek on GitHub (Jun 21, 2025).

Originally assigned to: @adamdotdevin on GitHub.

I don't know about TUI and I'm not sure if mouse operations can be performed on terminal text.

Note: I am using version 0.1.117.

Originally created by @douglarek on GitHub (Jun 21, 2025). Originally assigned to: @adamdotdevin on GitHub. I don't know about TUI and I'm not sure if mouse operations can be performed on terminal text. Note: I am using version 0.1.117.
yindo closed this issue 2026-02-16 17:25:46 -05:00
Author
Owner

@monotykamary commented on GitHub (Jun 21, 2025):

FWIW, block mode tmux copying still works. Otherwise, the effort for this shouldn't be too big.


  1. Add mouse drag selection handling in packages/tui/internal/tui/tui.go
  2. Track selection state (start/end positions) in the TUI model
  3. Modify message rendering to highlight selected text regions
  4. Add clipboard integration for copy functionality

Low-Medium effort - the foundational work is already complete:

  • Mouse support already implemented
  • Text rendering system in place using glamour
  • Event handling architecture established with Bubbletea

Approximately 150-300 lines of Go code:

  • Mouse selection logic: ~100 lines in tui.go
  • Selection state management: ~50 lines
  • Visual highlighting: ~50-100 lines (modify existing render functions)
  • Clipboard integration: ~50 lines
@monotykamary commented on GitHub (Jun 21, 2025): FWIW, block mode tmux copying still works. Otherwise, the effort for this shouldn't be too big. --- 1. **Add mouse drag selection handling** in `packages/tui/internal/tui/tui.go` 2. **Track selection state** (start/end positions) in the TUI model 3. **Modify message rendering** to highlight selected text regions 4. **Add clipboard integration** for copy functionality **Low-Medium effort** - the foundational work is already complete: - ✅ Mouse support already implemented - ✅ Text rendering system in place using `glamour` - ✅ Event handling architecture established with Bubbletea --- Approximately **150-300 lines** of Go code: - Mouse selection logic: ~100 lines in `tui.go` - Selection state management: ~50 lines - Visual highlighting: ~50-100 lines (modify existing render functions) - Clipboard integration: ~50 lines
Author
Owner

@cravenceiling commented on GitHub (Jun 21, 2025):

I think this is a duplicate of #212. You can select text by holding shift.

@cravenceiling commented on GitHub (Jun 21, 2025): I think this is a duplicate of #212. You can select text by holding shift.
Author
Owner

@monotykamary commented on GitHub (Jun 21, 2025):

you definitely can select text that way, but you also copy everything else in the UI:

Image

in tmux, you can use block copy and have a special pipe to parse it; this would probably be the goal if possible with bubbletea:

Image

edit: actually this lazy pipe works with tmux

bind-key -T copy-mode-vi Y send-keys -X copy-pipe "tmux show-buffer | claude -p 'Clean up this text by removing trailing whitespace, connecting lines appropriately, and making it readable as a single coherent block of text. Return only the cleaned text with no additional commentary: ' | pbcopy"

if we're super lazy, we could just hijack the copy and clean up the text through a cheap LLM

@monotykamary commented on GitHub (Jun 21, 2025): you definitely can select text that way, but you also copy everything else in the UI: <img width="762" alt="Image" src="https://github.com/user-attachments/assets/40671f79-844d-42ca-b0c3-410d7da4163f" /> in tmux, you can use block copy and have a special pipe to parse it; this would probably be the goal if possible with bubbletea: <img width="705" alt="Image" src="https://github.com/user-attachments/assets/92597e7c-bf86-4eab-9f54-ce7b816e6c1a" /> --- edit: actually this lazy pipe works with tmux ``` bind-key -T copy-mode-vi Y send-keys -X copy-pipe "tmux show-buffer | claude -p 'Clean up this text by removing trailing whitespace, connecting lines appropriately, and making it readable as a single coherent block of text. Return only the cleaned text with no additional commentary: ' | pbcopy" ``` if we're *super* lazy, we could just hijack the copy and clean up the text through a cheap LLM
Author
Owner

@orlandokj commented on GitHub (Jun 24, 2025):

I think it would be nice to have a copy option in the message, can be a command like /copy or maybe we can navigate the selected message through some keybind and then hit another keybind to copy it to clipboard.

@orlandokj commented on GitHub (Jun 24, 2025): I think it would be nice to have a copy option in the message, can be a command like /copy or maybe we can navigate the selected message through some keybind and then hit another keybind to copy it to clipboard.
Author
Owner

@adamdotdevin commented on GitHub (Jul 16, 2025):

taking the convo to #212

@adamdotdevin commented on GitHub (Jul 16, 2025): taking the convo to #212
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: anomalyco/opencode#210