Skip to content
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

Copy/Paste to terminal dosen't work in MacOSX #3

Closed
kevzettler opened this issue May 25, 2011 · 60 comments
Closed

Copy/Paste to terminal dosen't work in MacOSX #3

kevzettler opened this issue May 25, 2011 · 60 comments

Comments

@kevzettler
Copy link

Have Tested in Chrome, Safari, FF3

MacOSX uses the apple/option meta keys + c / v for copy paste the jQuery terminal code is not acknowledging these key combos

@jcubic
Copy link
Owner

jcubic commented May 25, 2011

Could you check what is keyCode and charCode of these keys and the value of ctrlKey and metaKey

@kevzettler
Copy link
Author

Sorry for the delay. Listed below is some console output from the key events. Here is more documentation on working with the branded key codes: http://unixpapa.com/js/key.html

Google Chrome:
Left
ctrlKey: false
metaKey: true
charCode: 0
keyCode: 91

Right
ctrlKey: false
metaKey: true
charCode: 0
keyCode: 93

FireFox
Left
ctrlKey: false
metaKey: true
charCode: 0
keyCode: 224

Right
Same as above

@jcubic
Copy link
Owner

jcubic commented Jun 13, 2011

Actually I want to know Command+C and Command+V "keyCode", "charCode" and "which" in keypress and keydown. What left and right mean?

@ghost ghost assigned jcubic Jun 13, 2011
@jcubic jcubic closed this as completed Jan 12, 2012
@arifamirani
Copy link

This issue seems to have not been solved. I can't paste anything in the terminal.

Using: Mac OSX 10.7.2
Chrome 17.0

@jcubic jcubic reopened this Mar 10, 2012
@jcubic
Copy link
Owner

jcubic commented Mar 10, 2012

It's hard for me to test but I ask one person some time ago if he can paste code into terminal, and he could he use Opera and Chrome I believe. Maybe it was not fix or I introduce new bug (the same one) again when I fix other bugs.

Can you paste into terminal in other Browsers? Are you using command+V (I didn't aks that person if he use command), does MacOS have control key that this user maybe used?

@kevzettler
Copy link
Author

I initially opened this issue and did some testing. However I don't have the same environment any more to recreate the tests. In my last update I have posted the meta and ctrl key data of using command+v. To answer the question of what left vs right means. It means there are two command keys on a Mac keyboard. Left and right. That is corresponding key status for both of them.

@ducin
Copy link
Contributor

ducin commented Mar 4, 2013

I'm using chrome on kubuntu.
I can paste text using ctrl+v, but I can't do this with shift+insert (which is standard for paste). What can I do to help to provide pasting with shift+insert?

@jcubic
Copy link
Owner

jcubic commented Mar 4, 2013

@tkoomzaaskz Added with this commit 645ae7e

@ducin
Copy link
Contributor

ducin commented Mar 4, 2013

great thanks, Kuba 👍

@abersnaze
Copy link

I think it's a timing issue. If I hold down the command-V it sometimes works. My guess is that this code isn't right.
function paste() {
clip.focus();
//wait until Browser insert text to textarea
self.oneTime(1, function() {
self.insert(clip.val());
clip.blur().val('');
});
}

either the browser has already put the text somewhere before the focus was switched to the clipboard div or the it didn't wait long enough.

@youurayy
Copy link
Contributor

@abersnaze thanks for your observation, helped!

when I put the code in a setTimeout(... , 1000) - the paste works fine. But I also had to make the paste() trigger on CMD+V - it did not work for CLTR+V and I don't know how to type SHIFT+Insert on my Macbook Pro keyboard:). (I'm working with Chrome on Mac.)

I'll submit a PR if I ever get some free time to get back to this.

@shellbryson
Copy link

We have jquery terminal in a project here and are seeing a reoccurrence of this problem - most of our developers are using Macs.

@sheymann
Copy link

sheymann commented Apr 3, 2014

any update on this issue? It is really annoying...

@jcubic
Copy link
Owner

jcubic commented Apr 3, 2014

@sheymann I don't have a way to test it. You can try @abersnaze solution just put 100, instead of 1 and check what is which and metaKey http://api.jquery.com/keydown/ when you copy/paste and add that in keydown function Line 1102.

If you make it work, you can create PR (modify jquery.terminal-src.js file).

@jcubic jcubic closed this as completed May 28, 2014
@jcubic jcubic reopened this May 28, 2014
@jcubic
Copy link
Owner

jcubic commented May 28, 2014

Finally a friend of mine test, 100ms work. It's in devel branch will be in version 0.9.

@eitoball
Copy link

I tried devel branch (2498aa4) on Mac OS X (10.9.4). It worked in Google Chrome (version 36.0.1985.125), but not in Firefox (version 31.0) nor Safari (version 7.0.5 (9537.77.4)). Let me know if you want to test with other settings.

@jcubic
Copy link
Owner

jcubic commented Jul 27, 2014

@eitoball Can you test by changing delay to 500 and 1000? It's line 1290 in devel branch

@jcubic jcubic reopened this Jul 27, 2014
@eitoball
Copy link

@eitoball Can you test by changing delay to 500 and 1000? It's line 1290 in devel branch

Sure.

Browser\Delay 1 10 100 500 1000 10000
Google Chrome (version 36.0.1985.125) OK OK OK OK OK OK
Firefox (version 31.0) OK OK OK OK OK OK
Safari (version 7.0.5 (9537.77.4) NG NG NG (*1) (*1) (*1)

(*1) If you try to press Command+v a couple of times, it works.

This is test code I use.

<!DOCTYPE HTML>
<html>
  <head>
    <link href="css/jquery.terminal-0.9.0_dev.css" rel="stylesheet">
  </head>
  <body>
    <div id="term_demo">
    </div>
    <script src="js/jquery-1.7.1.min.js"></script>
    <script src="js/jquery.terminal-0.9.0_dev.js"></script>
    <script>
$(function($, undefined) {
    $('#term_demo').terminal(function(command, term) {
      if (command !== '') {
        var result = window.eval(command);
        if (result != undefined) {
          term.echo(String(result));
        }
      }
    } , {
      greetings: 'Javascript Interpreter',
      name: 'js_demo',
      height: 200,
      width: 450,
      prompt: 'js>'
    });
});
    </script>
  </body>
</html>

When I reported first, I tried with JQuery 2.1.1. Maybe that is reason for different results in Firefox.

@jcubic
Copy link
Owner

jcubic commented Jul 27, 2014

Maybe this will be fixed if I keep focus in textarea all the time, and do the same as for mobile. I think that I'll need to do this for #86

jcubic added a commit that referenced this issue Aug 1, 2014
@jcubic
Copy link
Owner

jcubic commented Aug 1, 2014

Can anybody test on a Mac? I now use paste event if supported. Work on Linux Chrome and Firefox, don't have time to test on more browsers.

@jcubic
Copy link
Owner

jcubic commented Jul 31, 2016

@romanman I don't have access to Mac so I can't work on this issue. I've try to install OSX on virtual box but was not able to.

@romanman
Copy link

@jcubic : actually I have it on Windows 10 Chrome ,
maybe it's a different but when I copy some text
on the terminal the copy mark is removed by
refresh

@jcubic
Copy link
Owner

jcubic commented Jul 31, 2016

I'll try to install windows 10 on virtual box.

@romanman
Copy link

@jcubic , thanks is it that big difference ,
between chrome on win / linux / mac ???

@jcubic
Copy link
Owner

jcubic commented Jul 31, 2016

People report issues with Copy/Paste on Windows and Mac and I don't see any on linux so there must be differences.

@jcubic
Copy link
Owner

jcubic commented Aug 1, 2016

It seems that codalab fixed the issue, can you take a look at https://github.com/codalab/codalab-worksheets/blob/develop/codalab/apps/web/static/js/custom/jquery.terminal-0.8.8_custom.js if it works? It's old 0.8.8 but copy paste should work, I'll take that code and incorporate it in devel branch.

@jcubic
Copy link
Owner

jcubic commented Aug 17, 2016

Anyone? Can you test that file in previous comment?

@cupuyc
Copy link

cupuyc commented Aug 17, 2016

@jcubic First I tested on Mac. Mentioned file fixed copy/paste in one browser and broke in another. I looked which changes this file brings, comparing to original 0.8.8 version. I had luck to find out that few lines were removed. So I restored them and it became working on both Win/Mac FF/Chrome.

https://gist.github.com/cupuyc/7281eef0a19b3f4daf459f5dc1f291df

@jcubic
Copy link
Owner

jcubic commented Aug 19, 2016

Can you change without that content editable, is it needed?

@jcubic
Copy link
Owner

jcubic commented Aug 19, 2016

What about Safarii? Can you test if this return true or false in Safarii and Firefox on a Mac?
https://jsfiddle.net/8L73jfL4/

jcubic added a commit that referenced this issue Aug 19, 2016
@jcubic
Copy link
Owner

jcubic commented Sep 1, 2016

Can somebody test devel branch version on a Mac Chrome/Firefox/Safari?

@Tyratox
Copy link

Tyratox commented Sep 1, 2016

Devel branch works on my mac in Chrome 51.0.2704.84, Firefox 48.0.2 and Safari 9.1.3 (11601.7.8) 👍 :)

@jcubic
Copy link
Owner

jcubic commented Sep 1, 2016

Awesome, thanks.

@jcubic jcubic closed this as completed Sep 1, 2016
@jcubic
Copy link
Owner

jcubic commented Sep 2, 2016

Can somebody test this version in MacOSX chrome/firefox/safari? https://gist.github.com/jcubic/ce02aab838b9bdbb72761e20223f9b63 I've commented out content editable code that was created by codalab, it look like it's not needed, but I want to be sure.

@Tyratox
Copy link

Tyratox commented Sep 2, 2016

Works 👍 , tested in the same browsers as stated above.

@jcubic
Copy link
Owner

jcubic commented Sep 2, 2016

Great thanks again.

@stereobooster
Copy link
Contributor

Still a problem for Mac OS X + firefox

stereobooster added a commit to stereobooster/jquery.terminal that referenced this issue Feb 17, 2017
@jcubic jcubic reopened this Feb 17, 2017
jcubic added a commit that referenced this issue Feb 17, 2017
Fix for #3 Firefox MacOS paste problem in 1.0
@jcubic
Copy link
Owner

jcubic commented Feb 17, 2017

Will be fixed in 1.0.7

@jcubic jcubic closed this as completed Feb 17, 2017
@jcubic jcubic reopened this Feb 19, 2017
@jcubic
Copy link
Owner

jcubic commented Feb 22, 2017

Can anybody test devel version on a Mac? http://codepen.io/jcubic/pen/LxgJQG

@jcubic
Copy link
Owner

jcubic commented Feb 26, 2017

Tested on VirtualBox it work.

@jcubic jcubic closed this as completed Feb 26, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests