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(); return e.preventDefault();
}, },
keyCode: function(e) { keyCode: function(e) {
var kc; var c, kc;
kc = e.keyCode; key = (function() {
if ((65 <= kc && kc <= 90)) { switch (kc = e.keyCode) {
key = String.fromCharCode(kc); case 8:
if (!e.shiftKey) { return '';
key = key.toLowerCase(); 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 (key) {
if (e.altKey) { if (e.altKey) {
key = 'alt+' + key; key = 'alt+' + key;

View File

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

View File

@ -619,19 +619,26 @@ keybinds =
e.preventDefault() e.preventDefault()
keyCode: (e) -> keyCode: (e) ->
kc = e.keyCode key = switch kc = e.keyCode
if 65 <= kc <= 90 #A-Z when 8
key = String.fromCharCode kc ''
if !e.shiftKey when 27
key = key.toLowerCase() 'Esc'
else if 48 <= kc <= 57 #0-9 when 37
key = String.fromCharCode kc 'Left'
else if kc is 27 when 38
key = 'Esc' 'Up'
else if kc is 8 when 39
key = '' 'Right'
else when 40
key = null '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 key
if e.altKey then key = 'alt+' + key if e.altKey then key = 'alt+' + key
if e.ctrlKey then key = 'ctrl+' + key if e.ctrlKey then key = 'ctrl+' + key