diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 3ff730f..39f61e8 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -115,8 +115,12 @@ var IPython = (function (IPython) { that.execute_selected_cell(); return false; } else if (event.which === key.ENTER && event.altKey) { + // Execute code cell, and insert new in place that.execute_selected_cell(); - that.insert_cell_above('code'); + // Only insert a new cell, if we ended up in an already populated cell + if (that.get_selected_cell().toJSON().input !== "") { + that.insert_cell_above('code'); + } return false; } else if (event.which === key.ENTER && event.ctrlKey) { that.execute_selected_cell({terminal:true});