From 7080a1036215487d506a7b4f653d362c1587affc Mon Sep 17 00:00:00 2001 From: MinRK Date: Fri, 11 Oct 2013 15:36:41 +0200 Subject: [PATCH 1/2] split adds new cell above, rather than below preserves the order of code and output across split event rather than moving output into the middle of the split. --- IPython/html/static/notebook/js/notebook.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 711120932..891a8c859 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1161,15 +1161,15 @@ var IPython = (function (IPython) { var texta = cell.get_pre_cursor(); var textb = cell.get_post_cursor(); if (cell instanceof IPython.CodeCell) { - cell.set_text(texta); - var new_cell = this.insert_cell_below('code'); - new_cell.set_text(textb); + cell.set_text(textb); + var new_cell = this.insert_cell_above('code'); + new_cell.set_text(texta); } else if (cell instanceof IPython.MarkdownCell) { - cell.set_text(texta); + cell.set_text(textb); cell.render(); - var new_cell = this.insert_cell_below('markdown'); + var new_cell = this.insert_cell_above('markdown'); new_cell.edit(); // editor must be visible to call set_text - new_cell.set_text(textb); + new_cell.set_text(texta); new_cell.render(); } }; From c165b5713277db10a447c47598d441752e3a08de Mon Sep 17 00:00:00 2001 From: Paul Ivanov Date: Fri, 11 Oct 2013 08:52:02 -0700 Subject: [PATCH 2/2] split focuses the top of the newly created cell --- IPython/html/static/notebook/js/notebook.js | 2 ++ 1 file changed, 2 insertions(+) diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index 891a8c859..ccb16b6f8 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1164,6 +1164,7 @@ var IPython = (function (IPython) { cell.set_text(textb); var new_cell = this.insert_cell_above('code'); new_cell.set_text(texta); + this.select_next(); } else if (cell instanceof IPython.MarkdownCell) { cell.set_text(textb); cell.render(); @@ -1171,6 +1172,7 @@ var IPython = (function (IPython) { new_cell.edit(); // editor must be visible to call set_text new_cell.set_text(texta); new_cell.render(); + this.select_next(); } }; };