diff --git a/IPython/html/static/notebook/js/codecell.js b/IPython/html/static/notebook/js/codecell.js index 497266f09..d4a9e22ff 100644 --- a/IPython/html/static/notebook/js/codecell.js +++ b/IPython/html/static/notebook/js/codecell.js @@ -389,7 +389,7 @@ define([ * @private */ CodeCell.prototype._handle_set_next_input = function (payload) { - var data = {'cell': this, 'text': payload.text}; + var data = {'cell': this, 'text': payload.text, replace: payload.replace}; this.events.trigger('set_next_input.Notebook', data); }; diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 42c765ef6..60d2cb20b 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -209,9 +209,14 @@ define([ var that = this; this.events.on('set_next_input.Notebook', function (event, data) { - var index = that.find_cell_index(data.cell); - var new_cell = that.insert_cell_below('code',index); - new_cell.set_text(data.text); + if (data.replace) { + data.cell.set_text(data.text); + data.cell.clear_output(); + } else { + var index = that.find_cell_index(data.cell); + var new_cell = that.insert_cell_below('code',index); + new_cell.set_text(data.text); + } that.dirty = true; });