From b51276b70d013ed5da522329e80e26e21601801c 2014-01-07 22:42:36 From: Brian E. Granger Date: 2014-01-07 22:42:36 Subject: [PATCH] Split cell keyboard shortcut wired up. Merge markdown adds 2nd \n. --- diff --git a/IPython/html/static/notebook/js/keyboardmanager.js b/IPython/html/static/notebook/js/keyboardmanager.js index 67543e4..60552c8 100644 --- a/IPython/html/static/notebook/js/keyboardmanager.js +++ b/IPython/html/static/notebook/js/keyboardmanager.js @@ -241,6 +241,11 @@ var IPython = (function (IPython) { // Undo last cell delete = z notebook.undelete(); return false; + } else if (event.which === 189 || event.which === 173) { + // how fun! '-' is 189 in Chrome, but 173 in FF and Opera + // Split cell = - + notebook.split_cell(); + 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 d66914f..c0464c8 100644 --- a/IPython/html/static/notebook/js/notebook.js +++ b/IPython/html/static/notebook/js/notebook.js @@ -1079,7 +1079,7 @@ var IPython = (function (IPython) { cell.set_text(upper_text+'\n'+text); } else if (cell instanceof IPython.MarkdownCell) { cell.unrender(); - cell.set_text(upper_text+'\n'+text); + cell.set_text(upper_text+'\n\n'+text); cell.render(); }; this.delete_cell(index-1); @@ -1109,7 +1109,7 @@ var IPython = (function (IPython) { cell.set_text(text+'\n'+lower_text); } else if (cell instanceof IPython.MarkdownCell) { cell.unrender(); - cell.set_text(text+'\n'+lower_text); + cell.set_text(text+'\n\n'+lower_text); cell.render(); }; this.delete_cell(index+1);