diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index 28e4e14..940db3f 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -157,50 +157,8 @@ var IPython = (function (IPython) { return false; } }, - 'tab' : { - help : 'indent or complete', - help_index : 'ec', - }, - 'shift-tab' : { - help : 'tooltip', - help_index : 'ed', - }, }; - if (platform === 'MacOS') { - default_edit_shortcuts['cmd-/'] = - { - help : 'toggle comment', - help_index : 'ee' - }; - default_edit_shortcuts['cmd-]'] = - { - help : 'indent', - help_index : 'ef' - }; - default_edit_shortcuts['cmd-['] = - { - help : 'dedent', - help_index : 'eg' - }; - } else { - default_edit_shortcuts['ctrl-/'] = - { - help : 'toggle comment', - help_index : 'ee' - }; - default_edit_shortcuts['ctrl-]'] = - { - help : 'indent', - help_index : 'ef' - }; - default_edit_shortcuts['ctrl-['] = - { - help : 'dedent', - help_index : 'eg' - }; - } - // Command mode defaults var default_command_shortcuts = { diff --git a/IPython/html/static/notebook/js/quickhelp.js b/IPython/html/static/notebook/js/quickhelp.js index 4d9148d..fd43d62 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -12,12 +12,14 @@ var IPython = (function (IPython) { var QuickHelp = function (selector) { }; + var cmd_ctrl = 'Ctrl'; + var platform_specific; if (platform === 'MacOS') { // Mac OS X specific cmd_ctrl = 'Cmd'; - var platform_specific = [ + platform_specific = [ { shortcut: "Cmd-Up", help:"go to cell start" }, { shortcut: "Cmd-End", help:"go to cell start" }, { shortcut: "PageUp", help:"go to cell start" }, @@ -29,13 +31,13 @@ var IPython = (function (IPython) { { shortcut: "Home", help:"go to line start" }, { shortcut: "Cmd-Right", help:"go to line end" }, { shortcut:"End", help:"go to line end" }, - { shortcut:"Alt-Backspace", help:"del word before" }, - { shortcut:"Ctrl-Alt-Backspace", help:"del word after" }, - { shortcut:"Alt-Delete", help:"del word after" }, - ] + { shortcut:"Alt-Backspace", help:"del word before" }, + { shortcut:"Ctrl-Alt-Backspace", help:"del word after" }, + { shortcut:"Alt-Delete", help:"del word after" }, + ]; } else { // PC specific - var platform_specific = [ + platform_specific = [ { shortcut: "Ctrl-Home", help:"go to cell start" }, { shortcut: "Alt-Up", help:"go to cell start" }, { shortcut: "PageUp", help:"go to cell start" }, @@ -51,13 +53,13 @@ var IPython = (function (IPython) { { shortcut: "End", help:"go to line end" }, { shortcut: "Ctrl-Backspace", help:"del word before" }, { shortcut: "Ctrl-Delete", help:"del word after" }, - ] + ]; } var cm_shortcuts = [ { shortcut:"Insert", help:"toggle overwrite" }, - { shortcut:"Tab", help:"code completion" }, - { shortcut:"Shift-Tab", help:"help introspection" }, + { shortcut:"Tab", help:"code completion or indent" }, + { shortcut:"Shift-Tab", help:"tooltip" }, { shortcut: cmd_ctrl + "-]", help:"indent" }, { shortcut: cmd_ctrl + "-[", help:"dedent" }, { shortcut: cmd_ctrl + "-A", help:"select all" }, @@ -108,13 +110,9 @@ var IPython = (function (IPython) { element.append(cmd_div); // Edit mode - var edit_div = this.build_edit_help(); + var edit_div = this.build_edit_help(cm_shortcuts); element.append(edit_div); - // CodeMirror shortcuts - var cm_div = build_div('', cm_shortcuts); - element.append(cm_div); - this.shortcut_dialog = IPython.dialog.modal({ title : "Keyboard shortcuts", body : element, @@ -151,10 +149,10 @@ var IPython = (function (IPython) { }; - QuickHelp.prototype.build_edit_help = function () { + QuickHelp.prototype.build_edit_help = function (cm_shortcuts) { var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); - // Edit mode - return build_div('

Edit Mode (press Enter to enable)

', edit_shortcuts); + jQuery.extend(cm_shortcuts, edit_shortcuts); + return build_div('

Edit Mode (press Enter to enable)

', cm_shortcuts); }; var build_one = function (s) {