diff --git a/IPython/frontend/html/notebook/static/js/codecell.js b/IPython/frontend/html/notebook/static/js/codecell.js
index 2754937..41e7156 100644
--- a/IPython/frontend/html/notebook/static/js/codecell.js
+++ b/IPython/frontend/html/notebook/static/js/codecell.js
@@ -267,6 +267,9 @@ var IPython = (function (IPython) {
if (data.cell_type === 'code') {
if (data.input !== undefined) {
this.set_text(data.input);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ this.code_mirror.clearHistory();
}
if (data.prompt_number !== undefined) {
this.set_input_prompt(data.prompt_number);
diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js
index ef44f78..12268e9 100644
--- a/IPython/frontend/html/notebook/static/js/notebook.js
+++ b/IPython/frontend/html/notebook/static/js/notebook.js
@@ -602,6 +602,9 @@ var IPython = (function (IPython) {
text = '';
}
target_cell.set_text(text);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ target_cell.code_mirror.clearHistory();
source_element.remove();
this.dirty = true;
};
@@ -623,6 +626,9 @@ var IPython = (function (IPython) {
// The edit must come before the set_text.
target_cell.edit();
target_cell.set_text(text);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ target_cell.code_mirror.clearHistory();
source_element.remove();
this.dirty = true;
};
@@ -645,6 +651,9 @@ var IPython = (function (IPython) {
// The edit must come before the set_text.
target_cell.edit();
target_cell.set_text(text);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ target_cell.code_mirror.clearHistory();
source_element.remove();
this.dirty = true;
};
@@ -667,6 +676,9 @@ var IPython = (function (IPython) {
// The edit must come before the set_text.
target_cell.edit();
target_cell.set_text(text);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ target_cell.code_mirror.clearHistory();
source_element.remove();
this.dirty = true;
};
@@ -693,6 +705,9 @@ var IPython = (function (IPython) {
target_cell.set_level(level);
target_cell.edit();
target_cell.set_text(text);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ target_cell.code_mirror.clearHistory();
source_element.remove();
this.dirty = true;
};
diff --git a/IPython/frontend/html/notebook/static/js/textcell.js b/IPython/frontend/html/notebook/static/js/textcell.js
index 38b302e..2e52a75 100644
--- a/IPython/frontend/html/notebook/static/js/textcell.js
+++ b/IPython/frontend/html/notebook/static/js/textcell.js
@@ -158,6 +158,9 @@ var IPython = (function (IPython) {
if (data.cell_type === this.cell_type) {
if (data.source !== undefined) {
this.set_text(data.source);
+ // make this value the starting point, so that we can only undo
+ // to this state, instead of a blank cell
+ this.code_mirror.clearHistory();
this.set_rendered(data.rendered || '');
this.rendered = false;
this.render();