##// END OF EJS Templates
really fix the '-' key shortcuts now
Paul Ivanov -
Show More
@@ -43,12 +43,12 IPython.keyboard = (function (IPython) {
43
43
44 // These apply to Firefox and Opera
44 // These apply to Firefox and Opera
45 var _mozilla_keycodes = {
45 var _mozilla_keycodes = {
46 '; :': 59, '= +': 61, '- _': 173, 'minus': 173, 'meta': 224
46 '; :': 59, '= +': 61, '- _': 173, 'meta': 224
47 };
47 };
48
48
49 // This apply to Webkit and IE
49 // This apply to Webkit and IE
50 var _ie_keycodes = {
50 var _ie_keycodes = {
51 '; :': 186, '= +': 187, '- _': 189, 'minus': 189
51 '; :': 186, '= +': 187, '- _': 189
52 };
52 };
53
53
54 var browser = IPython.utils.browser[0];
54 var browser = IPython.utils.browser[0];
@@ -88,7 +88,7 IPython.keyboard = (function (IPython) {
88 // 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
88 // 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
89 // 4. Normalize keys
89 // 4. Normalize keys
90 shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
90 shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
91 shortcut = shortcut.replace(/-$/, 'minus'); // catch shortcuts using '-' key
91 shortcut = shortcut.replace(/-$/, '_'); // catch shortcuts using '-' key
92 var values = shortcut.split("-");
92 var values = shortcut.split("-");
93 if (values.length === 1) {
93 if (values.length === 1) {
94 return normalize_key(values[0]);
94 return normalize_key(values[0]);
@@ -104,6 +104,7 IPython.keyboard = (function (IPython) {
104 // Convert a shortcut (shift-r) to a jQuery Event object
104 // Convert a shortcut (shift-r) to a jQuery Event object
105 type = type || 'keydown';
105 type = type || 'keydown';
106 shortcut = normalize_shortcut(shortcut);
106 shortcut = normalize_shortcut(shortcut);
107 shortcut = shortcut.replace(/-$/, '_'); // catch shortcuts using '-' key
107 var values = shortcut.split("-");
108 var values = shortcut.split("-");
108 var modifiers = values.slice(0,-1);
109 var modifiers = values.slice(0,-1);
109 var key = values[values.length-1];
110 var key = values[values.length-1];
@@ -73,7 +73,7 var IPython = (function (IPython) {
73
73
74 var special_case = { pageup: "PageUp", pagedown: "Page Down", 'minus': '-' };
74 var special_case = { pageup: "PageUp", pagedown: "Page Down", 'minus': '-' };
75 var prettify = function (s) {
75 var prettify = function (s) {
76 s = s.replace('--', '-'); // catch shortcuts using '-' key
76 s = s.replace(/-$/, 'minus'); // catch shortcuts using '-' key
77 var keys = s.split('-');
77 var keys = s.split('-');
78 var k, i;
78 var k, i;
79 for (i in keys) {
79 for (i in keys) {
General Comments 0
You need to be logged in to leave comments. Login now