From 71eb69b5adc2b7d7afc34433b6c29e457ef86864 2014-01-07 22:42:36 From: Brian E. Granger Date: 2014-01-07 22:42:36 Subject: [PATCH] Add + for merge cell below and carefully manage split cell state. --- diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index 60552c8..c1effe6 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -245,7 +245,10 @@ var IPython = (function (IPython) { // how fun! '-' is 189 in Chrome, but 173 in FF and Opera // Split cell = - notebook.split_cell(); - return false; + return false; + } else if ((event.which === 61 || event.which === 187) && event.shiftKey) { + notebook.merge_cell_below(); + return false; }; // If we havn't handled it, let someone else. return true; diff --git a/IPython/html/static/notebook/js/notebook.js b/IPython/html/static/notebook/js/notebook.js index c0464c8..944805c 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1046,6 +1046,7 @@ var IPython = (function (IPython) { new_cell.set_text(texta); this.select_next(); } else if (cell instanceof IPython.MarkdownCell) { + var render = cell.rendered; cell.set_text(textb); cell.render(); var new_cell = this.insert_cell_above('markdown'); @@ -1053,6 +1054,13 @@ var IPython = (function (IPython) { new_cell.set_text(texta); new_cell.render(); this.select_next(); + if (!render) { + // The final rendered state of the split cells should + // match the original cell's state. The order matters + // here as we want the lower cell (cell) to be selected. + new_cell.unrender(); + cell.unrender(); + } } }; };