[FEATURE]: remove Copy with dragging.
Feature hasn't been suggested before.
- [x] I have verified this feature I'm about to request hasn't been suggested before.
Describe the enhancement you want to request
#2773 was posted 3 months ago.. but it is not being treated .
We don't need automatic Copying with text dragging.. Manual Select / Copy is enough.
I request this stupid function to be removed from opencode.
Everyone might really need to copy text in SSH session.
I wish this dumb Copying function be removed ASAP.
This issue might be a duplicate of existing issues. Please check:
- #2773: clipboard copy not works in remote SSH console (original issue from 3 months ago that you referenced)
- #4283: Copy To Clipboard is not working
- #5046: Can't copy text from opencode through mouse selection in Windows Terminal
- #2755: feat: Copy Mode for OpenCode
- #2125: Scrolling with weird text auto copies it to cursor input (related to auto-copy behavior)
Feel free to ignore if none of these address your specific case.
You can disable this by setting the env value OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true
You can disable this by setting the env value OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true
I put this in .profile export OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELEC=true and run source .profile . And opencode opened again but it failed to disable automatic copy.
Iterm2 - Ubuntu 24.04 remote server..
You can disable this by setting the env value OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true
I put this in .profile
export OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELEC=trueand runsource .profile. And opencode opened again but it failed to disable automatic copy.Iterm2 - Ubuntu 24.04 remote server..
The environment variable has a typo - it's missing the "T" at the end. Should be OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT (not SELEC). Fixed it and it works now! 👍
@rekram1-node I disabled copy on select flag When selecting text, the selection gets cleared, so nothing can be copied. This seems to come from:
if (Flag.OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT) {
renderer.clearSelection()
return
}
Even if renderer.clearSelection() is removed, how are we supposed to copy selected content? Ctrl+C is still used for exit, so there doesn’t seem to be a manual copy path.
yup we will fix that
Cool 👍 I’m happy to work on this if you can share your preferred approach
@kommander do you have a preference on this or is that something you want to take care of?
Not really. I'd just change it to get the selected text on a keybinding trigger and use the available "copy to clipboard" method and implementation. Biggest issue will be keybinding again, as many are overloaded and people will have contradicting expectations for the defaults again.
Not really. I'd just change it to get the selected text on a keybinding trigger and use the available "copy to clipboard" method and implementation. Biggest issue will be keybinding again, as many are overloaded and people will have contradicting expectations for the defaults again.
I actually started working on this locally and tried a similar approach by removing clearSelection() when the flag is enabled. I also handled Ctrl+C similar to #4900 if there’s selected content, Ctrl+C copies it; otherwise it shows the “Press again to exit” toast, which helps avoid accidental exits. But I don’t think this is the most optimal solution, so I wanted to check your preference before continuing
and is this behavior only present if someone sets the flag?
Yes, this only happens when the flag is enabled. If the flag is not set, selecting text works normally. Once the user releases the mouse, the text is copied as usual, and exiting requires pressing Ctrl+C twice.
Sounds good to me so far then
One note though: this works on macOS and Linux, but on Windows the first Ctrl C exits immediately. Looks like SIGINT kills the process before our handler runs. Might be related to #5071
Yes ctrl+c on windows, in conpty at least afaik, sends a CTRL_C_EVENT which seems not handled correctly by bun and is not translated to SIGINT, so that signal cannot actually be handled. Will be fixed upstream.
You can disable this by setting the env value OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true
I put this in .profile
export OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELEC=trueand runsource .profile. And opencode opened again but it failed to disable automatic copy. Iterm2 - Ubuntu 24.04 remote server..The environment variable has a typo - it's missing the "T" at the end. Should be OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT (not SELEC). Fixed it and it works now! 👍
Sorry being late comments.
I fixed it with setting OPENCODE_EXPERIMENTAL_DISABLE_COPY_ON_SELECT=true but got another issue.
It does not show 'copied to clipboard' message but could not keep selected text after dragging.
So I can not copy on SSH terminal again .
Does anyone have same experience or idea to fix it?
My Env. M1 Mac pro iterms2 SSH to Ubuntu 24.04 LTS server.