Skip to content

Commit

Permalink
clear previous callbacks on execute
Browse files Browse the repository at this point in the history
avoids mixed up display of multiple executions in one output area
when a cell is resubmitted.

closes ipython#4223
  • Loading branch information
minrk committed Sep 17, 2013
1 parent 50a0424 commit bca7425
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion IPython/html/static/notebook/js/codecell.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ var IPython = (function (IPython) {
this.input_prompt_number = null;
this.collapsed = false;
this.cell_type = "code";
this.last_msg_id = null;


var cm_overwrite_options = {
Expand Down Expand Up @@ -243,14 +244,17 @@ var IPython = (function (IPython) {
this.output_area.clear_output(true, true, true);
this.set_input_prompt('*');
this.element.addClass("running");
if (this.last_msg_id) {
this.kernel.clear_callbacks_for_msg(this.last_msg_id);
}
var callbacks = {
'execute_reply': $.proxy(this._handle_execute_reply, this),
'output': $.proxy(this.output_area.handle_output, this.output_area),
'clear_output': $.proxy(this.output_area.handle_clear_output, this.output_area),
'set_next_input': $.proxy(this._handle_set_next_input, this),
'input_request': $.proxy(this._handle_input_request, this)
};
var msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true});
this.last_msg_id = this.kernel.execute(this.get_text(), callbacks, {silent: false, store_history: true});
};

/**
Expand Down

0 comments on commit bca7425

Please sign in to comment.