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 e2883ca..ce6eea7 100644 --- a/IPython/html/static/notebook/js/quickhelp.js +++ b/IPython/html/static/notebook/js/quickhelp.js @@ -1,9 +1,5 @@ -//---------------------------------------------------------------------------- -// Copyright (C) 2008-2011 The IPython Development Team -// -// Distributed under the terms of the BSD License. The full license is in -// the file COPYING, distributed as part of this software. -//---------------------------------------------------------------------------- +// Copyright (c) IPython Development Team. +// Distributed under the terms of the Modified BSD License. //============================================================================ // QuickHelp button @@ -12,9 +8,55 @@ var IPython = (function (IPython) { "use strict"; + var platform = IPython.utils.platform; + var QuickHelp = function (selector) { }; + var cmd_ctrl = 'Ctrl-'; + var platform_specific; + + if (platform === 'MacOS') { + // Mac OS X specific + cmd_ctrl = 'Cmd-'; + platform_specific = [ + { shortcut: "Cmd-Up", help:"go to cell start" }, + { shortcut: "Cmd-Down", help:"go to cell end" }, + { shortcut: "Opt-Left", help:"go one word left" }, + { shortcut: "Opt-Right", help:"go one word right" }, + { shortcut: "Opt-Backspace", help:"del word before" }, + { shortcut: "Opt-Delete", help:"del word after" }, + ]; + } else { + // PC specific + platform_specific = [ + { shortcut: "Ctrl-Home", help:"go to cell start" }, + { shortcut: "Ctrl-Up", help:"go to cell start" }, + { shortcut: "Ctrl-End", help:"go to cell end" }, + { shortcut: "Ctrl-Down", help:"go to cell end" }, + { shortcut: "Ctrl-Left", help:"go one word left" }, + { shortcut: "Ctrl-Right", help:"go one word right" }, + { shortcut: "Ctrl-Backspace", help:"del word before" }, + { shortcut: "Ctrl-Delete", help:"del word after" }, + ]; + } + + var cm_shortcuts = [ + { 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" }, + { shortcut: cmd_ctrl + "z", help:"undo" }, + { shortcut: cmd_ctrl + "Shift-z", help:"redo" }, + { shortcut: cmd_ctrl + "y", help:"redo" }, + ].concat( platform_specific ); + + + + + + QuickHelp.prototype.show_keyboard_shortcuts = function () { // toggles display of keyboard shortcut dialog var that = this; @@ -51,7 +93,7 @@ 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); this.shortcut_dialog = IPython.dialog.modal({ @@ -91,10 +133,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('
Enter
to enable)Enter
to enable)