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 = { |
@@ -12,12 +12,14 b' var IPython = (function (IPython) {' | |||||
12 |
|
12 | |||
13 | var QuickHelp = function (selector) { |
|
13 | var QuickHelp = function (selector) { | |
14 | }; |
|
14 | }; | |
|
15 | ||||
15 | var cmd_ctrl = 'Ctrl'; |
|
16 | var cmd_ctrl = 'Ctrl'; | |
|
17 | var platform_specific; | |||
16 |
|
18 | |||
17 | if (platform === 'MacOS') { |
|
19 | if (platform === 'MacOS') { | |
18 | // Mac OS X specific |
|
20 | // Mac OS X specific | |
19 | cmd_ctrl = 'Cmd'; |
|
21 | cmd_ctrl = 'Cmd'; | |
20 |
|
|
22 | platform_specific = [ | |
21 | { shortcut: "Cmd-Up", help:"go to cell start" }, |
|
23 | { shortcut: "Cmd-Up", help:"go to cell start" }, | |
22 | { shortcut: "Cmd-End", help:"go to cell start" }, |
|
24 | { shortcut: "Cmd-End", help:"go to cell start" }, | |
23 | { shortcut: "PageUp", help:"go to cell start" }, |
|
25 | { shortcut: "PageUp", help:"go to cell start" }, | |
@@ -29,13 +31,13 b' var IPython = (function (IPython) {' | |||||
29 | { shortcut: "Home", help:"go to line start" }, |
|
31 | { shortcut: "Home", help:"go to line start" }, | |
30 | { shortcut: "Cmd-Right", help:"go to line end" }, |
|
32 | { shortcut: "Cmd-Right", help:"go to line end" }, | |
31 | { shortcut:"End", help:"go to line end" }, |
|
33 | { shortcut:"End", help:"go to line end" }, | |
32 |
{ shortcut:"Alt-Backspace", |
|
34 | { shortcut:"Alt-Backspace", help:"del word before" }, | |
33 |
{ shortcut:"Ctrl-Alt-Backspace", |
|
35 | { shortcut:"Ctrl-Alt-Backspace", help:"del word after" }, | |
34 |
{ shortcut:"Alt-Delete", |
|
36 | { shortcut:"Alt-Delete", help:"del word after" }, | |
35 | ] |
|
37 | ]; | |
36 | } else { |
|
38 | } else { | |
37 | // PC specific |
|
39 | // PC specific | |
38 |
|
|
40 | platform_specific = [ | |
39 | { shortcut: "Ctrl-Home", help:"go to cell start" }, |
|
41 | { shortcut: "Ctrl-Home", help:"go to cell start" }, | |
40 | { shortcut: "Alt-Up", help:"go to cell start" }, |
|
42 | { shortcut: "Alt-Up", help:"go to cell start" }, | |
41 | { shortcut: "PageUp", help:"go to cell start" }, |
|
43 | { shortcut: "PageUp", help:"go to cell start" }, | |
@@ -51,13 +53,13 b' var IPython = (function (IPython) {' | |||||
51 | { shortcut: "End", help:"go to line end" }, |
|
53 | { shortcut: "End", help:"go to line end" }, | |
52 | { shortcut: "Ctrl-Backspace", help:"del word before" }, |
|
54 | { shortcut: "Ctrl-Backspace", help:"del word before" }, | |
53 | { shortcut: "Ctrl-Delete", help:"del word after" }, |
|
55 | { shortcut: "Ctrl-Delete", help:"del word after" }, | |
54 | ] |
|
56 | ]; | |
55 | } |
|
57 | } | |
56 |
|
58 | |||
57 | var cm_shortcuts = [ |
|
59 | var cm_shortcuts = [ | |
58 | { shortcut:"Insert", help:"toggle overwrite" }, |
|
60 | { shortcut:"Insert", help:"toggle overwrite" }, | |
59 | { shortcut:"Tab", help:"code completion" }, |
|
61 | { shortcut:"Tab", help:"code completion or indent" }, | |
60 |
{ shortcut:"Shift-Tab", help:" |
|
62 | { shortcut:"Shift-Tab", help:"tooltip" }, | |
61 | { shortcut: cmd_ctrl + "-]", help:"indent" }, |
|
63 | { shortcut: cmd_ctrl + "-]", help:"indent" }, | |
62 | { shortcut: cmd_ctrl + "-[", help:"dedent" }, |
|
64 | { shortcut: cmd_ctrl + "-[", help:"dedent" }, | |
63 | { shortcut: cmd_ctrl + "-A", help:"select all" }, |
|
65 | { shortcut: cmd_ctrl + "-A", help:"select all" }, | |
@@ -108,13 +110,9 b' var IPython = (function (IPython) {' | |||||
108 | element.append(cmd_div); |
|
110 | element.append(cmd_div); | |
109 |
|
111 | |||
110 | // Edit mode |
|
112 | // Edit mode | |
111 | var edit_div = this.build_edit_help(); |
|
113 | var edit_div = this.build_edit_help(cm_shortcuts); | |
112 | element.append(edit_div); |
|
114 | element.append(edit_div); | |
113 |
|
115 | |||
114 | // CodeMirror shortcuts |
|
|||
115 | var cm_div = build_div('', cm_shortcuts); |
|
|||
116 | element.append(cm_div); |
|
|||
117 |
|
||||
118 | this.shortcut_dialog = IPython.dialog.modal({ |
|
116 | this.shortcut_dialog = IPython.dialog.modal({ | |
119 | title : "Keyboard shortcuts", |
|
117 | title : "Keyboard shortcuts", | |
120 | body : element, |
|
118 | body : element, | |
@@ -151,10 +149,10 b' var IPython = (function (IPython) {' | |||||
151 |
|
149 | |||
152 | }; |
|
150 | }; | |
153 |
|
151 | |||
154 | QuickHelp.prototype.build_edit_help = function () { |
|
152 | QuickHelp.prototype.build_edit_help = function (cm_shortcuts) { | |
155 | var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); |
|
153 | var edit_shortcuts = IPython.keyboard_manager.edit_shortcuts.help(); | |
156 | // Edit mode |
|
154 | jQuery.extend(cm_shortcuts, edit_shortcuts); | |
157 |
return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', |
|
155 | return build_div('<h4>Edit Mode (press <code>Enter</code> to enable)</h4>', cm_shortcuts); | |
158 | }; |
|
156 | }; | |
159 |
|
157 | |||
160 | var build_one = function (s) { |
|
158 | var build_one = function (s) { |
General Comments 0
You need to be logged in to leave comments.
Login now