diff --git a/IPython/html/static/notebook/js/cell.js b/IPython/html/static/notebook/js/cell.js index cc365a3..5813064 100644 --- a/IPython/html/static/notebook/js/cell.js +++ b/IPython/html/static/notebook/js/cell.js @@ -125,11 +125,14 @@ var IPython = (function (IPython) { return a.has(b).length !==0 || a.is(b); } if (that.mode === 'edit') { + // Most of the time, when a cell is in edit mode and focusout + // fires, it means we should enter command mode. But there are cases + // when we should not enter command mode. setTimeout(function () { var trigger = true; var target = $(document.activeElement); - var completer = that.element.find($('div.completions')); - var tooltip = $('div#tooltip') + var completer = $('div.completions'); + var tooltip = $('div#tooltip'); if (target.length > 0) { // If the focused element (target) is inside the cell // (that.element) don't enter command mode. diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js index c2ea602..f089879 100644 --- a/IPython/html/static/notebook/js/completer.js +++ b/IPython/html/static/notebook/js/completer.js @@ -218,6 +218,8 @@ var IPython = (function (IPython) { this.complete = $('
').addClass('completions'); this.complete.attr('id', 'complete'); + // Currently webkit doesn't use the size attr correctly. See: + // https://code.google.com/p/chromium/issues/detail?id=4579 this.sel = $('') .attr('multiple', 'true') .attr('size', Math.min(10, this.raw_result.length)); @@ -255,8 +257,6 @@ var IPython = (function (IPython) { this.build_gui_list(this.raw_result); this.sel.focus(); - // This needs to be after the focus() call because that puts the notebook into - // command mode. IPython.keyboard_manager.null_mode(); // Opera sometimes ignores focusing a freshly created node if (window.opera) setTimeout(function () {