From eb47f0eb8db5cb5d45537b2f593a82f1b7285ca8 Mon Sep 17 00:00:00 2001 From: v923z Date: Thu, 19 Jul 2012 22:35:38 +0300 Subject: [PATCH] Added some comments to the Alt-Enter code part, and also added checking whether a new code cell is really needed. --- IPython/frontend/html/notebook/static/js/notebook.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index 3ff730f0f..39f61e857 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});