Show More
@@ -37,7 +37,6 b' var IPython = (function (IPython) {' | |||
|
37 | 37 | this.kernel = kernel || null; |
|
38 | 38 | this.code_mirror = null; |
|
39 | 39 | this.input_prompt_number = null; |
|
40 | this.tooltip_on_tab = true; | |
|
41 | 40 | this.collapsed = false; |
|
42 | 41 | this.default_mode = 'python'; |
|
43 | 42 | IPython.Cell.apply(this, arguments); |
@@ -48,7 +47,6 b' var IPython = (function (IPython) {' | |||
|
48 | 47 | ); |
|
49 | 48 | }; |
|
50 | 49 | |
|
51 | ||
|
52 | 50 | CodeCell.prototype = new IPython.Cell(); |
|
53 | 51 | |
|
54 | 52 | /** |
@@ -142,6 +140,17 b' var IPython = (function (IPython) {' | |||
|
142 | 140 | } else { |
|
143 | 141 | return true; |
|
144 | 142 | }; |
|
143 | } else if (event.keyCode === key.TAB && event.type == 'keydown' && event.shiftKey) { | |
|
144 | if (editor.somethingSelected()){ | |
|
145 | var anchor = editor.getCursor("anchor"); | |
|
146 | var head = editor.getCursor("head"); | |
|
147 | if( anchor.line != head.line){ | |
|
148 | return false; | |
|
149 | } | |
|
150 | } | |
|
151 | IPython.tooltip.request(that); | |
|
152 | event.stop(); | |
|
153 | return true; | |
|
145 | 154 | } else if (event.keyCode === key.TAB && event.type == 'keydown') { |
|
146 | 155 | // Tab completion. |
|
147 | 156 | //Do not trim here because of tooltip |
@@ -151,7 +160,7 b' var IPython = (function (IPython) {' | |||
|
151 | 160 | // Don't autocomplete if the part of the line before the cursor |
|
152 | 161 | // is empty. In this case, let CodeMirror handle indentation. |
|
153 | 162 | return false; |
|
154 |
} else if ((pre_cursor.substr(-1) === "("|| pre_cursor.substr(-1) === " ") && |
|
|
163 | } else if ((pre_cursor.substr(-1) === "("|| pre_cursor.substr(-1) === " ") && IPython.config.tooltip_on_tab ) { | |
|
155 | 164 | IPython.tooltip.request(that); |
|
156 | 165 | // Prevent the event from bubbling up. |
|
157 | 166 | event.stop(); |
@@ -22,7 +22,7 b' var IPython = (function (IPython) {' | |||
|
22 | 22 | * @static |
|
23 | 23 | * |
|
24 | 24 | **/ |
|
25 | var config = { | |
|
25 | var default_config = { | |
|
26 | 26 | /** |
|
27 | 27 | * Dictionary of object to autodetect highlight mode for code cell. |
|
28 | 28 | * Item of the dictionnary should take the form : |
@@ -63,10 +63,14 b' var IPython = (function (IPython) {' | |||
|
63 | 63 | */ |
|
64 | 64 | raw_cell_highlight : { |
|
65 | 65 | 'diff' :{'reg':[/^diff/]} |
|
66 | } | |
|
66 | }, | |
|
67 | ||
|
68 | tooltip_on_tab : true, | |
|
67 | 69 | }; |
|
68 | 70 | |
|
69 | IPython.config = config; | |
|
71 | // use the same method to merge user configuration | |
|
72 | IPython.config = {}; | |
|
73 | $.extend(IPython.config, default_config); | |
|
70 | 74 | |
|
71 | 75 | return IPython; |
|
72 | 76 |
@@ -228,6 +228,10 b' var IPython = (function (IPython) {' | |||
|
228 | 228 | ch: 0 |
|
229 | 229 | }, cursor).trim(); |
|
230 | 230 | |
|
231 | if(editor.somethingSelected()){ | |
|
232 | text = editor.getSelection(); | |
|
233 | } | |
|
234 | ||
|
231 | 235 | // need a permanent handel to code_mirror for future auto recall |
|
232 | 236 | this.code_mirror = editor; |
|
233 | 237 | |
@@ -288,7 +292,15 b' var IPython = (function (IPython) {' | |||
|
288 | 292 | var w = $(this.code_mirror.getScrollerElement()).width(); |
|
289 | 293 | // ofset of the editor |
|
290 | 294 | var o = $(this.code_mirror.getScrollerElement()).offset(); |
|
291 | var pos = this.code_mirror.cursorCoords(); | |
|
295 | ||
|
296 | // whatever anchor/head order but arrow at mid x selection | |
|
297 | var anchor = this.code_mirror.cursorCoords(false); | |
|
298 | var head = this.code_mirror.cursorCoords(true); | |
|
299 | var pos = {}; | |
|
300 | pos.y = head.y | |
|
301 | pos.yBot = head.yBot | |
|
302 | pos.x = (head.x+anchor.x)/2; | |
|
303 | ||
|
292 | 304 | var xinit = pos.x; |
|
293 | 305 | var xinter = o.left + (xinit - o.left) / w * (w - 450); |
|
294 | 306 | var posarrowleft = xinit - xinter; |
General Comments 0
You need to be logged in to leave comments.
Login now