Skip to content
Browse files

Flip ctrlKey and metaKey properties on Opera Mac

I don't know what they were thinking, but this, on
recent Opera versions, seems to give the correct
result.

Closes #10
  • Loading branch information...
1 parent 949bcc4 commit 54095aac018b76c8cc29a234fcc2f79ce8cab622 @marijnh marijnh committed Sep 18, 2012
Showing with 3 additions and 2 deletions.
  1. +3 −2 lib/codemirror.js
View
5 lib/codemirror.js
@@ -612,10 +612,11 @@ window.CodeMirror = (function() {
}, 50);
var name = keyNames[e_prop(e, "keyCode")], handled = false;
+ var flipCtrlCmd = opera && mac;
if (name == null || e.altGraphKey) return false;
if (e_prop(e, "altKey")) name = "Alt-" + name;
- if (e_prop(e, "ctrlKey")) name = "Ctrl-" + name;
- if (e_prop(e, "metaKey")) name = "Cmd-" + name;
+ if (e_prop(e, flipCtrlCmd ? "metaKey" : "ctrlKey")) name = "Ctrl-" + name;
+ if (e_prop(e, flipCtrlCmd ? "ctrlKey" : "metaKey")) name = "Cmd-" + name;
var stopped = false;
function stop() { stopped = true; }

0 comments on commit 54095aa

Please sign in to comment.
Something went wrong with that request. Please try again.