Make undelete respect order after insertions/deletions.

This commit is contained in:
David Warde-Farley 2012-11-06 16:29:21 -05:00
parent bb8249864d
commit 8ecb8cd8fe

View File

@ -574,6 +574,11 @@ var IPython = (function (IPython) {
// index = cell index or undefined to insert below selected
index = this.index_or_selected(index);
var cell = null;
// This is intentionally < rather than <= for the sake of more
// sensible behavior in some cases.
if (this.undelete_index !== null && index < this.undelete_index) {
this.undelete_index = this.undelete_index + 1;
}
if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
if (type === 'code') {
cell = new IPython.CodeCell(this.kernel);
@ -608,6 +613,9 @@ var IPython = (function (IPython) {
// index = cell index or undefined to insert above selected
index = this.index_or_selected(index);
var cell = null;
if (this.undelete_index !== null && index <= this.undelete_index) {
this.undelete_index = this.undelete_index + 1;
}
if (this.ncells() === 0 || this.is_valid_cell_index(index)) {
if (type === 'code') {
cell = new IPython.CodeCell(this.kernel);