Copy and Paste behaviour under Linux
Description
Background
You might be aware that Linux famously has two copy and paste buffers. It's a bit annoying but generally speaking I'm used to it.
I can paste into my terminal using my mouse in one of two ways;
- I can middle click and paste automatically happens (call this buffer 1)
- I can right click and select paste from the menu (call this buffer 2)
As you can see each of these two ways uses a different buffer.
First issue
Because OpenCode does something to disable my right click menu; I am unable to paste from buffer 2 into OpenCode.
It's a bit annoying. I've found myself having to paste things into a GUI text editor from buffer 2, then copy them into buffer 1 so I can middle click paste them into opencode. It's a lot of extra clicks just to copy and paste.
Second issue
When highlight text, it is automatically copied to my clipboard.
Linux already has this feature built in.. By default when I highlight things in my terminal they are automatically copied in to buffer 1.
Open Code actually copies the text into buffer 2. On the face of it, it's not a big issue because every other app lets me paste from either buffer.
However when I want to copy from OpenCode and then paste back into OpenCode, because I'm trying to repeat back a small bit of text ... I can't, because the copy goes into buffer 2, and I'm only able to paste from buffer 1.
Suggested Fix
I wonder if perhaps we could not disable the right click menu? Or perhaps there could be an option to disable the mouse integration? I never use that anyway.
Alternatively; change how the copy and paste works. I don't know enough to make suggestions around that however.
OpenCode version
v0.1.50 (currently the latest)
Terminal
Tillix and tmux
This issue might be a duplicate of existing issues. Please check:
- #3684: [FEATURE]: On Linux/Wayland allow pasting with middle click
- #3081: I can't paste text with CTRL+V or right mouse click when running inside WSL
- #943: selection clipboard integration in linux
- #2413: Copy to clipboard is not working on Pop-os
- #2845: How to disable text selection and clipboard overrides?
- #4751: [FEATURE]: Add config option to disable copy-on-select
- #1771: bug: opencode kills
ghosttyclipborad on copy from opencode
Feel free to ignore if none of these address your specific case.
Not an exact duplicate of any of those; but they are all relevant in some way.
@astrolox could we mark this as a dup of #3684?
Seems like they are asking for same thing since u said:
I wonder if perhaps we could not disable the right click menu?
I don't think it's a matter of us disabling it I think it's just that since this is a TUI unlike some other tools, we need to implement some of these behaviors ourselves instead of being able to rely on your terminal taking care of it for us
@astrolox parcellite can be quite useful if you are annoyed of having 2 separate buffers (it can automatically sync them and avoid the annoyance you described in the original comment) - I've been using it for 15+ years 😄
I don't really know what the best solution is. I wanted to convey the problem specifically rather than a solution because you may know better than I.
The easiest thing would be the ability to disable mouse integration and let the terminal just handle all mouse interactions. In that way it is a duplicate.
For example copy text into the same buffer which you allow me to paste from. In that way my problem goes away and your tool is consistent with the default terminal behaviour. However I have no idea if that's even possible for you.
Implementing your own right click menu might be another avenue but would be a large task if done just for this problem.
parcellitecan be quite useful if you are annoyed of having 2 separate buffers
I quite like having 2 now I'm used to it. However I need them to work consistently across multiple applications. That's really the crux of my bug report, opencode is inconsistent with everything else on my desktop in this regard.
I really can't use this software if it's intentionally breaking my setup.
Proper copy and paste works in my terminal. (Select to copy, middle click to insert) This app broke this absolutely needlessly.