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

Different behaviour for Cmd+C, Cmd+v, etc on Mac #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

petethepig
Copy link

It allows you to copy/paste any text from/into the terminal.
I suggest it, since this is the default behaviour in Terminal.app on Mac.

@jagill
Copy link

jagill commented Feb 7, 2014

+1
Copy and paste doesn't work for Macs, at least in the way that everyone tries. No one will try Opt-C/V!

@chjj
Copy link
Owner

chjj commented Feb 7, 2014

Now I'm confused. The isMac and ev.metaKey check is there to check for a mac's equivalent of Alt (which is Option, I think?). Why would that if statement affect the Command key? This change would also stop a whole range of key combinations from working.

Could either of you show me the raw event output for keydown of Cmd+[anything] in the browser? It should be event.ctrlKey.

@jagill
Copy link

jagill commented Feb 7, 2014

The check for Cmd in mac is event.metaKey. Option is event.altKey. Ctrl is event.ctrlKey.

Here is Cmd-C:

jQuery.Event {originalEvent: KeyboardEvent, type: "keydown", isDefaultPrevented: function, timeStamp: 1391791240401, jQuery182012300834944471717: true…}
altKey: false
attrChange: undefined
attrName: undefined
bubbles: true
cancelable: true
char: undefined
charCode: 0
ctrlKey: false
currentTarget: Window
data: null
delegateTarget: Window
eventPhase: 3
handleObj: Object
isDefaultPrevented: function returnFalse() { // 3279
jQuery182012300834944471717: true
key: undefined
keyCode: 67
metaKey: true
originalEvent: KeyboardEvent
relatedNode: undefined
relatedTarget: undefined
shiftKey: false
srcElement: textarea.ace_text-input
target: textarea.ace_text-input
timeStamp: 1391791240401
type: "keydown"
view: Window
which: 67

Here is Opt-C:

jQuery.Event {originalEvent: KeyboardEvent, type: "keydown", isDefaultPrevented: function, timeStamp: 1391791248160, jQuery182012300834944471717: true…}
altKey: true
attrChange: undefined
attrName: undefined
bubbles: true
cancelable: true
char: undefined
charCode: 0
ctrlKey: false
currentTarget: Window
data: null
delegateTarget: Window
eventPhase: 3
handleObj: Object
isDefaultPrevented: function returnFalse() { // 3279
jQuery182012300834944471717: true
key: undefined
keyCode: 229
metaKey: false
originalEvent: KeyboardEvent
relatedNode: undefined
relatedTarget: undefined
shiftKey: false
srcElement: textarea.ace_text-input
target: textarea.ace_text-input
timeStamp: 1391791248160
type: "keydown"
view: Window
which: 229

Here is Ctrl-C:

jQuery.Event {originalEvent: KeyboardEvent, type: "keydown", isDefaultPrevented: function, timeStamp: 1391791364750, jQuery182012300834944471717: true…}
altKey: false
attrChange: undefined
attrName: undefined
bubbles: true
cancelable: true
char: undefined
charCode: 0
ctrlKey: true
currentTarget: Window
data: null
delegateTarget: Window
eventPhase: 3
handleObj: Object
isDefaultPrevented: function returnFalse() { // 3279
jQuery182012300834944471717: true
key: undefined
keyCode: 67
metaKey: false
originalEvent: KeyboardEvent
relatedNode: undefined
relatedTarget: undefined
shiftKey: false
srcElement: textarea.ace_text-input
target: textarea.ace_text-input
timeStamp: 1391791364750
type: "keydown"
view: Window
which: 67

@chjj
Copy link
Owner

chjj commented Feb 7, 2014

Ah, okay. So command is considered meta (seriously unfamiliar with mac keyboards). Gotcha. Yeah, I'll add a better check that won't disrupt any other key combinations either. Thanks for checking.

@jagill
Copy link

jagill commented Feb 7, 2014

Yeah, the mode key event attributes in mac are very non-intuitive.

@soumith
Copy link

soumith commented Apr 27, 2014

@petethepig thanks for your patch, works great.

@jessetane
Copy link
Contributor

@chjj would be nice to have this or something to its effect

@takluyver
Copy link

See also PR #37. I'm not a Mac user, but assuming that Option+key on Mac should work like Alt+key on other systems, I think that one is preferable - this one appears to disable all Alt shortcuts on Macs.

@yoshiokatsuneo
Copy link

I tried to support Cmd-C, Cmd-V on Mac using hidden textarea.
#97

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants