Permalink
Browse files

Bind additional defaults.

These defaults work with my standard keyboard and Google Chrome. My
keyboard is a Kinesis Advantage so its not exactly a standard
layout. Testing across keyboards and browsers is needed, but I'm
putting that off until everything else is done
  • Loading branch information...
1 parent 83fd963 commit 9de2ec3e449661fcf15567270add39eeb5e67b56 @rhburrows committed Jun 23, 2011
Showing with 23 additions and 1 deletion.
  1. +23 −1 src/defaults.js
View
@@ -24,6 +24,10 @@
editor.backspace();
},
+ '<TAB>' : function(editor) {
+ editor.insertChar('\t');
+ },
+
'<SPACE>' : insertF(' '),
'<ENTER>' : insertF('\n'),
'S-1' : insertF('!'),
@@ -61,6 +65,24 @@
editor.previousLine();
}
};
+
+ // some keys on my keyboard don't match js defaults
+ // Bind these by hand because javascript thinks they are extended characters
+ var extra = {
+ '\\187' : ['=', '+'],
+ '\\188' : [',', '<'],
+ '\\190' : ['.', '>'],
+ '\\191' : ['/', '?'],
+ '\\219' : ['[', '{'],
+ '\\220' : ['\\', '|'],
+ '\\221' : [']', '}'],
+ '\\222' : ['\'', '"']
+ };
+ $.each(extra, function(code, values) {
+ defaultKeys[code] = function(e){ e.insertChar(values[0]); };
+ defaultKeys['S-'+code] = function(e){ e.insertChar(values[1]); };
+ });
+
// Uppercase and lowercase letters
for (var j=65; j<91; j++) {
var c = String.fromCharCode(j);
@@ -70,7 +92,7 @@
// 0-9
for (var n=48; n<58; n++) {
var num = String.fromCharCode(n);
- defaultKeys[num] = insertF(num);
+ defaultKeys[n] = insertF(num);
}
$.fn.s2e.config.keybindings = defaultKeys;

0 comments on commit 9de2ec3

Please sign in to comment.