##// END OF EJS Templates
Merge pull request #5436 from ivanov/cm-shorcuts-quickhelp...
Min RK -
r16126:1ebcc426 merge
parent child Browse files
Show More
@@ -157,50 +157,8 b' var IPython = (function (IPython) {'
157 return false;
157 return false;
158 }
158 }
159 },
159 },
160 'tab' : {
161 help : 'indent or complete',
162 help_index : 'ec',
163 },
164 'shift-tab' : {
165 help : 'tooltip',
166 help_index : 'ed',
167 },
168 };
160 };
169
161
170 if (platform === 'MacOS') {
171 default_edit_shortcuts['cmd-/'] =
172 {
173 help : 'toggle comment',
174 help_index : 'ee'
175 };
176 default_edit_shortcuts['cmd-]'] =
177 {
178 help : 'indent',
179 help_index : 'ef'
180 };
181 default_edit_shortcuts['cmd-['] =
182 {
183 help : 'dedent',
184 help_index : 'eg'
185 };
186 } else {
187 default_edit_shortcuts['ctrl-/'] =
188 {
189 help : 'toggle comment',
190 help_index : 'ee'
191 };
192 default_edit_shortcuts['ctrl-]'] =
193 {
194 help : 'indent',
195 help_index : 'ef'
196 };
197 default_edit_shortcuts['ctrl-['] =
198 {
199 help : 'dedent',
200 help_index : 'eg'
201 };
202 }
203
204 // Command mode defaults
162 // Command mode defaults
205
163
206 var default_command_shortcuts = {
164 var default_command_shortcuts = {
@@ -1,9 +1,5 b''
1 //----------------------------------------------------------------------------
1 // Copyright (c) IPython Development Team.
2 // Copyright (C) 2008-2011 The IPython Development Team
2 // Distributed under the terms of the Modified BSD License.
3 //
4 // Distributed under the terms of the BSD License. The full license is in
5 // the file COPYING, distributed as part of this software.
6 //----------------------------------------------------------------------------
7
3
8 //============================================================================
4 //============================================================================
9 // QuickHelp button
5 // QuickHelp button
@@ -12,9 +8,55 b''
12 var IPython = (function (IPython) {
8 var IPython = (function (IPython) {
13 "use strict";
9 "use strict";
14
10
11 var platform = IPython.utils.platform;
12
15 var QuickHelp = function (selector) {
13 var QuickHelp = function (selector) {
16 };
14 };
17
15
16 var cmd_ctrl = 'Ctrl-';
17 var platform_specific;
18
19 if (platform === 'MacOS') {
20 // Mac OS X specific
21 cmd_ctrl = 'Cmd-';
22 platform_specific = [
23 { shortcut: "Cmd-Up", help:"go to cell start" },
24 { shortcut: "Cmd-Down", help:"go to cell end" },
25 { shortcut: "Opt-Left", help:"go one word left" },
26 { shortcut: "Opt-Right", help:"go one word right" },
27 { shortcut: "Opt-Backspace", help:"del word before" },
28 { shortcut: "Opt-Delete", help:"del word after" },
29 ];
30 } else {
31 // PC specific
32 platform_specific = [
33 { shortcut: "Ctrl-Home", help:"go to cell start" },
34 { shortcut: "Ctrl-Up", help:"go to cell start" },
35 { shortcut: "Ctrl-End", help:"go to cell end" },
36 { shortcut: "Ctrl-Down", help:"go to cell end" },
37 { shortcut: "Ctrl-Left", help:"go one word left" },
38 { shortcut: "Ctrl-Right", help:"go one word right" },
39 { shortcut: "Ctrl-Backspace", help:"del word before" },
40 { shortcut: "Ctrl-Delete", help:"del word after" },
41 ];
42 }
43
44 var cm_shortcuts = [
45 { shortcut:"Tab", help:"code completion or indent" },
46 { shortcut:"Shift-Tab", help:"tooltip" },
47 { shortcut: cmd_ctrl + "]", help:"indent" },
48 { shortcut: cmd_ctrl + "[", help:"dedent" },
49 { shortcut: cmd_ctrl + "a", help:"select all" },
50 { shortcut: cmd_ctrl + "z", help:"undo" },
51 { shortcut: cmd_ctrl + "Shift-z", help:"redo" },
52 { shortcut: cmd_ctrl + "y", help:"redo" },
53 ].concat( platform_specific );
54
55
56
57
58
59
18 QuickHelp.prototype.show_keyboard_shortcuts = function () {
60 QuickHelp.prototype.show_keyboard_shortcuts = function () {
19 // toggles display of keyboard shortcut dialog
61 // toggles display of keyboard shortcut dialog
20 var that = this;
62 var that = this;
@@ -51,7 +93,7 b' var IPython = (function (IPython) {'
51 element.append(cmd_div);
93 element.append(cmd_div);
52
94
53 // Edit mode
95 // Edit mode
54 var edit_div = this.build_edit_help();
96 var edit_div = this.build_edit_help(cm_shortcuts);
55 element.append(edit_div);
97 element.append(edit_div);
56
98
57 this.shortcut_dialog = IPython.dialog.modal({
99 this.shortcut_dialog = IPython.dialog.modal({
@@ -91,10 +133,10 b' var IPython = (function (IPython) {'
91
133
92 };
134 };
93
135
94 QuickHelp.prototype.build_edit_help = function () {
136 QuickHelp.prototype.build_edit_help = function (cm_shortcuts) {
95 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
137 var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help();
96 // Edit mode
138 jQuery.extend(cm_shortcuts, edit_shortcuts);
97 return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', edit_shortcuts);
139 return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', cm_shortcuts);
98 };
140 };
99
141
100 var build_one = function (s) {
142 var build_one = function (s) {
@@ -394,10 +394,6 b' Ctrl-m . restart kernel'
394 Ctrl-m h show keyboard shortcuts
394 Ctrl-m h show keyboard shortcuts
395 ============ ==========================
395 ============ ==========================
396
396
397 .. seealso::
398
399 :ref:`Some additional Codemirror keyboard shortcuts <cm_keyboard>`
400
401
397
402
398
403 Plotting
399 Plotting
1 NO CONTENT: file was removed
NO CONTENT: file was removed
General Comments 0
You need to be logged in to leave comments. Login now