mirror of
https://github.com/jupyter/notebook.git
synced 2025-01-24 12:05:22 +08:00
handle keyboard shortcuts ending with '-'
This commit is contained in:
parent
4cf1717980
commit
21ebaf2e32
@ -88,12 +88,14 @@ IPython.keyboard = (function (IPython) {
|
||||
// 3. Sort '-' separated modifiers into the order alt-ctrl-meta-shift
|
||||
// 4. Normalize keys
|
||||
shortcut = shortcut.toLowerCase().replace('cmd', 'meta');
|
||||
shortcut = shortcut.replace('--', '-'); // catch shortcuts using '-' key
|
||||
var values = shortcut.split("-");
|
||||
if (values.length === 1) {
|
||||
return normalize_key(values[0]);
|
||||
} else {
|
||||
var modifiers = values.slice(0,-1);
|
||||
var key = normalize_key(values[values.length-1]);
|
||||
key = key || '-'; // '-' will make the key undefined, since we split on it
|
||||
modifiers.sort();
|
||||
return modifiers.join('-') + '-' + key;
|
||||
}
|
||||
|
@ -71,8 +71,9 @@ var IPython = (function (IPython) {
|
||||
return build_div('<h4>Command Mode (press <code>Esc</code> to enable)</h4>', command_shortcuts);
|
||||
};
|
||||
|
||||
var special_case = { pageup: "PageUp", pagedown: "Page Down" };
|
||||
var special_case = { pageup: "PageUp", pagedown: "Page Down", '': '-' };
|
||||
var prettify = function (s) {
|
||||
s = s.replace('--', '-'); // catch shortcuts using '-' key
|
||||
var keys = s.split('-');
|
||||
var k, i;
|
||||
for (i in keys) {
|
||||
|
Loading…
Reference in New Issue
Block a user