opencode icon indicating copy to clipboard operation
opencode copied to clipboard

Copy To Clipboard is not working

Open maheshmuttintidev opened this issue 2 months ago • 22 comments

Description

I selected some text from the response but its not copied to clipboard, please resolve this issue. these are my os related info.

OpenCode version

1.0.62

Steps to reproduce

  1. run opencode in terminal
  2. ask any question
  3. select the response text (few lines or complete)
  4. it shows copied to clipboard
  5. try to paste the (ctrl+v or cmd+v)
  6. paste won't work or it will paste last copied text other than this opencode

Screenshot and/or share link

Image Image

Operating System

24.04

Terminal

Terminal (Default Ubuntu One) and Vscode Terminal As well

maheshmuttintidev avatar Nov 13 '25 09:11 maheshmuttintidev

This issue might be a duplicate of existing issues. Please check:

  • #3538: Unable to copy using shortcut from TUI - similar clipboard issues where text selection shows 'copied to clipboard' but doesn't actually copy
  • #2413: Copy to clipboard is not working on Pop-os (closed) - very similar issue on Linux
  • #2773: Clipboard copy not works in remote SSH console - similar clipboard functionality issues

Feel free to ignore if none of these address your specific case.

github-actions[bot] avatar Nov 13 '25 09:11 github-actions[bot]

I have the same problem running opencode via ssh on remote machines.

burbilog avatar Nov 13 '25 09:11 burbilog

it seems there is no straight forward fix for this issue, at-least please provide context menu on text selection and show copy option please..

maheshmuttintidev avatar Nov 13 '25 14:11 maheshmuttintidev

This issue might be a duplicate of existing issues. Please check:

Feel free to ignore if none of these address your specific case.

i've checked above, but it doesn't resolve this bug yet, please try to escalate to author and fix this bug in future release (this maybe medium priority)

maheshmuttintidev avatar Nov 13 '25 14:11 maheshmuttintidev

i have the same issue

velorb avatar Nov 13 '25 16:11 velorb

Same issue, found it in multiline. Paste is broken it seems, because I am getting the text from a notepad.

redknightlois avatar Nov 13 '25 19:11 redknightlois

I'm having same issue

Haupc avatar Nov 21 '25 10:11 Haupc

Same thing here, it don't work on the default terminal but it works on vs codes terminal which is weird

dhogenson avatar Nov 21 '25 23:11 dhogenson

I have noted this issue, but it has a couple of subtleties, and its not clear how to tease them out individually.

"Select-to-copy" fails when:

  • The selection (mouse-drag) is done slowly, and unidirectionally. Almost always a 'fast', one-direction-only, select action works.
  • The selection (mouse-drag) is done fast but multi-directionally (when the drag action overshoots, and you go back).

Note sure if that helps.

@kommander are there any settings that might affect this feature (e.g. scroll-speed)?

taqtiqa-mark avatar Nov 25 '25 18:11 taqtiqa-mark

I want to provide a generalized copyToClipboard from opentui, as opencode currently does that manually and it does not work remote either because of missing osc52 handling. It's on my list, please excuse the delay, just a little more patience, I'll get to it.

kommander avatar Nov 25 '25 22:11 kommander

surprisingly, the copy to clipboard is working in iterm2, but not in-built terminal, it would be better if you look into this issue, because it was more useful for me especially (the developer like me as well)

maheshmuttintidev avatar Nov 27 '25 16:11 maheshmuttintidev

On my Linux Mint installing xclip solved the problem:

sudo apt install xclip

Pity that the TUI doesn't warn when a dependency is missing

ominiverdi avatar Dec 03 '25 09:12 ominiverdi

On my Linux Mint installing xclip solved the problem:

sudo apt install xclip

Pity that the TUI doesn't warn when a dependency is missing

This is crazy. What if I'm using ssh to work remotely and have NO X11 at all?

Some kind of settings is needed, then, "no X11 clipboard" or something like that.

burbilog avatar Dec 03 '25 11:12 burbilog

It does both, currently, it copies to local clipboard and sends osc52 for ssh. But osc52 seems broken the way it is implemented currently and it shouldn't do both by default. It's on my list, the list is just very long, I'll get to it.

kommander avatar Dec 03 '25 12:12 kommander

On my Linux Mint installing xclip solved the problem:

sudo apt install xclip

Pity that the TUI doesn't warn when a dependency is missing

Thanks man. It really worked. I hope opencode add this fix probably!

maheshmuttintidev avatar Dec 05 '25 06:12 maheshmuttintidev

I habe the problem on windows running opencode in docker...

enving avatar Dec 08 '25 08:12 enving

additional reporting from me:

Image

when copying hello${variableName}world the ${...} is not copied (blank)

actual result: hello world expected result: hello${variableName}world

terminal: Rio OS: Windows non WSL

it's working fine in Rio terminal on my Mac

AngDrew avatar Dec 09 '25 10:12 AngDrew

I have it working with SSH to VM with opencode and Ubuntu 24.10. It does not work with SSH to VM with opencode and Arch Linux.

Both zsh and tmux, same tmux configuration. Still finding differences in both systems....

janorga avatar Dec 11 '25 01:12 janorga

I have it working with SSH to VM with opencode and Ubuntu 24.10. It does not work with SSH to VM with opencode and Arch Linux.

Both zsh and tmux, same tmux configuration. Still finding differences in both systems....

Found! tmux config in Arch was not exactly the same, I was missing set -g allow-passthrough on

So at opencode 1.0.143 is working for me with "Linux" SSH to VM, tmux and opencode.

janorga avatar Dec 11 '25 01:12 janorga