Show More
@@ -221,6 +221,7 b' var IPython = (function (IPython) {' | |||
|
221 | 221 | // Currently webkit doesn't use the size attr correctly. See: |
|
222 | 222 | // https://code.google.com/p/chromium/issues/detail?id=4579 |
|
223 | 223 | this.sel = $('<select style="width: auto"/>') |
|
224 | .attr('tabindex', -1) | |
|
224 | 225 | .attr('multiple', 'true') |
|
225 | 226 | .attr('size', Math.min(10, this.raw_result.length)); |
|
226 | 227 | this.complete.append(this.sel); |
@@ -248,36 +249,16 b' var IPython = (function (IPython) {' | |||
|
248 | 249 | this.sel.dblclick(function () { |
|
249 | 250 | that.pick(); |
|
250 | 251 | }); |
|
251 | this.sel.blur($.proxy(this.close, this)); | |
|
252 |
|
|
|
253 | // Ignore tab key since it causes the completer to reshow on some | |
|
254 | // machines and not with others. This strange behavior is due to | |
|
255 | // the fact that we are tricking the notebook into thinking that it | |
|
256 | // is in edit mode when it's really not. | |
|
257 | if (IPython.keyboard.event_to_shortcut(event)=='tab') { | |
|
258 | event.stopPropagation(); | |
|
259 | event.preventDefault(); | |
|
260 | } else { | |
|
261 | that.keydown(event); | |
|
262 | } | |
|
252 | this.editor.on('keydown', function (event) { | |
|
253 | that.keydown(event); | |
|
263 | 254 | }); |
|
264 |
this. |
|
|
255 | this.editor.on('keypress', function (event) { | |
|
265 | 256 | that.keypress(event); |
|
266 | 257 | }); |
|
267 | 258 | |
|
268 | 259 | this.build_gui_list(this.raw_result); |
|
269 | 260 | |
|
270 | 261 | this.sel.focus(); |
|
271 | // Since the completer can and will gain focus and it isn't a component | |
|
272 | // of the codemirror instance, we need to manually "fake" codemirror as | |
|
273 | // still being focused. This is accomplished by calling edit_mode on | |
|
274 | // the cell when the completer gains focus, and command mode when the | |
|
275 | // completer loses focus. If the completer was an actual, true extension | |
|
276 | // of codemirror, we wouldn't have to play this game since codemirror | |
|
277 | // wouldn't blur when the completer was shown. | |
|
278 | this.cell.edit_mode(); | |
|
279 | $([IPython.events]).trigger('edit_mode.Notebook'); | |
|
280 | IPython.keyboard_manager.disable(); | |
|
281 | 262 | // Opera sometimes ignores focusing a freshly created node |
|
282 | 263 | if (window.opera) setTimeout(function () { |
|
283 | 264 | if (!this.done) this.sel.focus(); |
@@ -301,16 +282,6 b' var IPython = (function (IPython) {' | |||
|
301 | 282 | Completer.prototype.close = function () { |
|
302 | 283 | this.done = true; |
|
303 | 284 | $('#complete').remove(); |
|
304 | // Since the completer can and will gain focus and it isn't a component | |
|
305 | // of the codemirror instance, we need to manually "fake" codemirror as | |
|
306 | // still being focused. This is accomplished by calling edit_mode on | |
|
307 | // the cell when the completer gains focus, and command mode when the | |
|
308 | // completer loses focus. If the completer was an actual, true extension | |
|
309 | // of codemirror, we wouldn't have to play this game since codemirror | |
|
310 | // wouldn't blur when the completer was shown. | |
|
311 | this.cell.command_mode(); | |
|
312 | $([IPython.events]).trigger('command_mode.Notebook'); | |
|
313 | IPython.keyboard_manager.enable(); | |
|
314 | 285 | }; |
|
315 | 286 | |
|
316 | 287 | Completer.prototype.pick = function () { |
General Comments 0
You need to be logged in to leave comments.
Login now