diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js
index 3ef98ff09..c833825d0 100644
--- a/IPython/html/static/notebook/js/codecell.js
+++ b/IPython/html/static/notebook/js/codecell.js
@@ -413,8 +413,8 @@ var IPython = (function (IPython) {
// Cancel this unfocus event if the base wants to cancel or the cell
// completer is open or the tooltip is open.
return IPython.Cell.prototype.should_cancel_blur.apply(this) ||
- (this.completer && this.completer.is_visible()) ||
- (IPython.tooltip && IPython.tooltip.is_visible());
+ (this.completer && this.completer.was_shown()) ||
+ (IPython.tooltip && IPython.tooltip.was_shown());
};
CodeCell.prototype.select_all = function () {
diff --git a/IPython/html/static/notebook/js/completer.js b/IPython/html/static/notebook/js/completer.js
index 3fd724558..1c9421ae3 100644
--- a/IPython/html/static/notebook/js/completer.js
+++ b/IPython/html/static/notebook/js/completer.js
@@ -74,6 +74,7 @@ var IPython = (function (IPython) {
var Completer = function (cell) {
this._visible = false;
+ this._shown = false;
this.cell = cell;
this.editor = cell.code_mirror;
var that = this;
@@ -90,6 +91,13 @@ var IPython = (function (IPython) {
return this._visible;
};
+ Completer.prototype.was_shown = function () {
+ // Return whether or not the completer was shown.
+ var ret = this._shown;
+ this._shown = false;
+ return ret;
+ };
+
Completer.prototype.startCompletion = function () {
// call for a 'first' completion, that will set the editor and do some
// special behaviour like autopicking if only one completion availlable
@@ -231,6 +239,7 @@ var IPython = (function (IPython) {
.attr('size', Math.min(10, this.raw_result.length));
this.complete.append(this.sel);
this._visible = true;
+ this._shown = true;
$('body').append(this.complete);
// After everything is on the page, compute the postion.
@@ -289,6 +298,7 @@ var IPython = (function (IPython) {
Completer.prototype.close = function () {
this._visible = false;
+ this._shown = false;
if (this.done) return;
this.done = true;
$('.completions').remove();
diff --git a/IPython/html/static/notebook/js/tooltip.js b/IPython/html/static/notebook/js/tooltip.js
index 915cca4a0..f059c2293 100644
--- a/IPython/html/static/notebook/js/tooltip.js
+++ b/IPython/html/static/notebook/js/tooltip.js
@@ -30,6 +30,7 @@ var IPython = (function (IPython) {
// handle to html
this.tooltip = $('#tooltip');
this._hidden = true;
+ this._shown = false;
// variable for consecutive call
this._old_cell = null;
@@ -128,6 +129,10 @@ var IPython = (function (IPython) {
return !this._hidden;
};
+ Tooltip.prototype.was_shown = function () {
+ return this._shown;
+ };
+
Tooltip.prototype.showInPager = function (cell) {
// reexecute last call in pager by appending ? to show back in pager
var that = this;
@@ -156,6 +161,7 @@ var IPython = (function (IPython) {
// and reset it's status
Tooltip.prototype._hide = function () {
this._hidden = true;
+ this._shown = false;
this.tooltip.fadeOut('fast');
$('#expanbutton').show('slow');
this.text.removeClass('bigtooltip');
@@ -370,6 +376,7 @@ var IPython = (function (IPython) {
}
this._hidden = false;
+ this._show = true;
this.tooltip.fadeIn('fast');
this.text.children().remove();