Skip to content

Copy-paste not working well in terminal #237

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ihainan opened this issue Mar 14, 2019 · 25 comments
Closed

Copy-paste not working well in terminal #237

ihainan opened this issue Mar 14, 2019 · 25 comments
Labels
bug Something isn't working

Comments

@ihainan
Copy link

ihainan commented Mar 14, 2019

  • code-server version: 1.31.0-20-x86_64-linux
  • OS Version: Ubuntu 18.04.1 LTS
  • Client Info: macOS 10.14.3 + Chrome 72.0.3626.121

I've read Issue #161 and tried @avelino 's solution, but the copy-paste function still can't work in terminal.

Steps to Reproduce

I recorded a video to show how to reproduce this issue:

  1. Select text in terminal and press <⌘ + C> to copy text
  2. Press <⌘ + V> to paste text (not working)
  3. Go to the editor area, then return back to the terminal
  4. Press <⌘ + V> again
@ihainan ihainan added the bug Something isn't working label Mar 14, 2019
@avelino
Copy link
Contributor

avelino commented Mar 14, 2019

VSCode configuration does not work for the terminal, it is editor configuration

@ihainan
Copy link
Author

ihainan commented Mar 15, 2019

Thanks @avelino. I can't find a place to configure the terminal, so it's a bug of code-server, right?

@naufraghi
Copy link

Similar problem on Linux, both with C-c C-v and X11 selection clipboard / middle click paste.

@shi-yan
Copy link

shi-yan commented Mar 22, 2019

I couldn't copy from the terminal and paste into the text editor

@4oo4
Copy link

4oo4 commented Mar 22, 2019

What browsers is everyone using? This problem only happens with me when using Firefox, with Chromium Ctrl + Shift + V works. One thing I noticed is that when I right click in the terminal, in Chromium next to paste it says the key combo, while in Firefox it says "must use keybind".

  • Server OS: Ubuntu 16.04 (code-server running in Ubuntu 18.04 docker container)
  • Client OS: Ubuntu 16.04
  • Firefox: 65.0.1
  • Chromium: 73.0.3664.3 (Developer Build)

I'm wondering if the key combo doesn't work some of the time because the nativeClibpoard condition may not always be satisfied?
Selection_009

I did some more testing and when I change that key combo condition to just terminalFocus, Ctrl + Shift + C works in Firefox to copy (not sure if changing the setting made that work), and Chromium still works too.

Firefox might be blocking access to the clipboard since it's coming from javascript, according to this, if it's still accurate: https://support.mozilla.org/en-US/questions/1068472#answer-744685

I'm also messing with about:config in Firefox to see if I can allow that site access:
http://kb.mozillazine.org/Granting_JavaScript_access_to_the_clipboard

In the meantime, in addition to Ctrl + Shift + C for copy, Ctrl + Ins works for that too, while Shift + Ins works for paste.

@shi-yan
Copy link

shi-yan commented Mar 23, 2019

I use the latest chrome.

copy and pasting doesn't work for me even with the right click menu.

it's hard to say when it works and when it doesn't. Sometimes, I had trouble copying and pasting at a fresh launch. Then I saw chrome ask me if I allow the page to access clipboard. if I click "allow", copying pasting will work fine. But sometimes, this notification won't show.

At one point, I also saw an error pop up from the bottom right corner saying electron.clipboard isn't a function or something. the error message went away pretty quickly, I didn't capture it.

@syntaxhacker
Copy link

Sometimes cant even type or paste into editor when terminal is open ¯_(ツ)_/¯

@shi-yan
Copy link

shi-yan commented Mar 23, 2019

I realized my copy and pasting issue might be due to "copy on select".

when I try to paste into the editor, I first select the text I want to replace.

it seems that during selection, the selected text gets copied into the clipboard, so when I paste, it actually pastes the same content as my selection. This made me thinking pasting didn't work.

But I googled, while you can enable "copy on select" with some extension, the default vscode won't do it.

@yamajik
Copy link
Contributor

yamajik commented Mar 28, 2019

Anyone has ideas?This troubles me.

@cristiano-belloni
Copy link

it seems that during selection, the selected text gets copied into the clipboard, so when I paste, it actually pastes the same content as my selection

Same behaviour for me (serving code-server from Ubuntu Bionic, accessing it with Chrome / mac os). Copy on select is always on; it'd be great to be able to disable it.

@kylecarbs
Copy link
Member

This might be fixed now. We've made some changes to the copy/paste.

@MostHated
Copy link

This might be fixed now. We've made some changes to the copy/paste.

Fresh install here on a Google Cloud Platform Ubuntu (specs below from Neofetch). I canno't paste into the terminal.

            .-/+oossssoo+/-.               mosthated@hpcsdev 
        `:+ssssssssssssssssss+:`           ----------------- 
      -+ssssssssssssssssssyyssss+-         OS: Ubuntu 18.04.2 LTS x86_64 
    .ossssssssssssssssssdMMMNysssso.       Host: Google Compute Engine 
   /ssssssssssshdmmNNmmyNMMMMhssssss/      Kernel: 4.15.0-1030-gcp 
  +ssssssssshmydMMMMMMMNddddyssssssss+     Uptime: 5 hours, 14 mins 
 /sssssssshNMMMyhhyyyyhmNMMMNhssssssss/    Packages: 921 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.   Shell: bash 4.4.19 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+   Terminal: /dev/pts/4 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   CPU: Intel Xeon (1) @ 2.300GHz 
ossyNMMMNyMMhsssssssssssssshmmmhssssssso   Memory: 2069MiB / 3693MiB 
+sssshhhyNMMNyssssssssssssyNMMMysssssss+ 
.ssssssssdMMMNhsssssssssshNMMMdssssssss.                           
 /sssssssshNMMMyhhyyyyhdNMMMNhssssssss/ 
  +sssssssssdmydMMMMMMMMddddyssssssss+ 
   /ssssssssssshdmNNNNmyNMMMMhssssss/ 
    .ossssssssssssssssssdMMMNysssso. 
      -+sssssssssssssssssyyyssss+- 
        `:+ssssssssssssssssss+:` 
            .-/+oossssoo+/-. 

@MostHated
Copy link

Just an update to this. It seems like Firefox has the most issue. In Chrome and Vivaldi it works just fine if you make sure to set clipboard permission.

@xeron56
Copy link

xeron56 commented Jun 24, 2019

step:1 , make sure code server is running on "https://" not http
step:2, In Chrome set clipboard permission go to chrome://settings/content/clipboard and add your server url
step3: now ctrl + v will work in code server

@deansheather
Copy link
Member

If this is a Chromium permissions issue we might want to add a notification when users try the shortcut for the first time on Chromium browsers. CC: @code-asher @kylecarbs

@NGarate
Copy link

NGarate commented Jul 2, 2019

For me it also fails sometimes in safari on iPadOs beta 3

@jo32
Copy link

jo32 commented Oct 23, 2019

fail on chrome Version 77.0.3865.120 (Official Build) (64-bit) + Mac OS 10.14.4

@sr229
Copy link
Contributor

sr229 commented Oct 23, 2019

@jo32 refer to @shahidul56's workaround. This is a Chrome permissions issue.

@code-asher
Copy link
Member

Closing to consolidate into #1106.

@Ming-Qin-tech
Copy link

@shahidul56 thx very much! it works for me!

@dentropy
Copy link

I have the same problem in firefox 74.0 in Windows. Paste works fine on my chrome based browser.

@nhooyr
Copy link
Contributor

nhooyr commented Mar 23, 2020

@dentropy See #1106

@kgpyi
Copy link

kgpyi commented Jun 19, 2020

is this solved, I am still facing it, I mean i can copy but not paste

@nhooyr
Copy link
Contributor

nhooyr commented Jun 22, 2020

@winetoys Please see #1106

@xinmans
Copy link

xinmans commented Dec 12, 2024

For me it also fails sometimes in safari on iPadOs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests