##// END OF EJS Templates
handle keyboard shortcuts ending with '-'
Paul Ivanov -
Show More
@@ -88,12 +88,14 b' 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('--', '-'); // catch shortcuts using '-' key
91 var values = shortcut.split("-");
92 var values = shortcut.split("-");
92 if (values.length === 1) {
93 if (values.length === 1) {
93 return normalize_key(values[0]);
94 return normalize_key(values[0]);
94 } else {
95 } else {
95 var modifiers = values.slice(0,-1);
96 var modifiers = values.slice(0,-1);
96 var key = normalize_key(values[values.length-1]);
97 var key = normalize_key(values[values.length-1]);
98 key = key || '-'; // '-' will make the key undefined, since we split on it
97 modifiers.sort();
99 modifiers.sort();
98 return modifiers.join('-') + '-' + key;
100 return modifiers.join('-') + '-' + key;
99 }
101 }
@@ -71,8 +71,9 b' var IPython = (function (IPython) {'
71 return build_div('<h4>Command Mode (press <code>Esc</code> to enable)</h4>', command_shortcuts);
71 return build_div('<h4>Command Mode (press <code>Esc</code> to enable)</h4>', command_shortcuts);
72 };
72 };
73
73
74 var special_case = { pageup: "PageUp", pagedown: "Page Down" };
74 var special_case = { pageup: "PageUp", pagedown: "Page Down", '': '-' };
75 var prettify = function (s) {
75 var prettify = function (s) {
76 s = s.replace('--', '-'); // catch shortcuts using '-' key
76 var keys = s.split('-');
77 var keys = s.split('-');
77 var k, i;
78 var k, i;
78 for (i in keys) {
79 for (i in keys) {
General Comments 0
You need to be logged in to leave comments. Login now