Merge branch 'master' into QR

This commit is contained in:
James Campos 2011-09-05 15:50:08 -07:00
commit 1106014e00
3 changed files with 83 additions and 28 deletions

View File

@ -867,22 +867,69 @@
return e.preventDefault();
},
keyCode: function(e) {
var kc;
kc = e.keyCode;
if ((65 <= kc && kc <= 90)) {
key = String.fromCharCode(kc);
if (!e.shiftKey) {
key = key.toLowerCase();
var c, kc;
key = (function() {
switch (kc = e.keyCode) {
case 8:
return '';
case 27:
return 'Esc';
case 37:
return 'Left';
case 38:
return 'Up';
case 39:
return 'Right';
case 40:
return 'Down';
case 48:
case 49:
case 50:
case 51:
case 52:
case 53:
case 54:
case 55:
case 56:
case 57:
return String.fromCharCode(kc);
case 65:
case 66:
case 67:
case 68:
case 69:
case 70:
case 71:
case 72:
case 73:
case 74:
case 75:
case 76:
case 77:
case 78:
case 79:
case 80:
case 81:
case 82:
case 83:
case 84:
case 85:
case 86:
case 87:
case 88:
case 89:
case 90:
c = String.fromCharCode(kc);
if (e.shiftKey) {
return c;
} else {
return c.toLowerCase();
}
break;
default:
return null;
}
} else if ((48 <= kc && kc <= 57)) {
key = String.fromCharCode(kc);
} else if (kc === 27) {
key = 'Esc';
} else if (kc === 8) {
key = '';
} else {
key = null;
}
})();
if (key) {
if (e.altKey) {
key = 'alt+' + key;

View File

@ -1,6 +1,7 @@
master
- mayhem
quote inlining default styling (by xat)
add up/down/right/left keybinding support
2.19.2
- mayhem

View File

@ -619,19 +619,26 @@ keybinds =
e.preventDefault()
keyCode: (e) ->
kc = e.keyCode
if 65 <= kc <= 90 #A-Z
key = String.fromCharCode kc
if !e.shiftKey
key = key.toLowerCase()
else if 48 <= kc <= 57 #0-9
key = String.fromCharCode kc
else if kc is 27
key = 'Esc'
else if kc is 8
key = ''
else
key = null
key = switch kc = e.keyCode
when 8
''
when 27
'Esc'
when 37
'Left'
when 38
'Up'
when 39
'Right'
when 40
'Down'
when 48, 49, 50, 51, 52, 53, 54, 55, 56, 57 #0-9
String.fromCharCode kc
when 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90 #A-Z
c = String.fromCharCode kc
if e.shiftKey then c else c.toLowerCase()
else
null
if key
if e.altKey then key = 'alt+' + key
if e.ctrlKey then key = 'ctrl+' + key