From 904be21a9ff22d5f4334ae1c4d564b8ccce822d9 Mon Sep 17 00:00:00 2001 From: David Wyde Date: Tue, 2 Apr 2013 17:44:27 -0500 Subject: [PATCH 1/2] Prevent errors when up/down arrows are pressed in an empty notebook. Notebook.get_selected_cell() returns `null` in an empty notebook. --- IPython/frontend/html/notebook/static/js/notebook.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index a65107674..cd9e2b9f5 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -137,13 +137,13 @@ var IPython = (function (IPython) { } if (event.which === key.UPARROW && !event.shiftKey) { var cell = that.get_selected_cell(); - if (cell.at_top()) { + if (cell && cell.at_top()) { event.preventDefault(); that.select_prev(); }; } else if (event.which === key.DOWNARROW && !event.shiftKey) { var cell = that.get_selected_cell(); - if (cell.at_bottom()) { + if (cell && cell.at_bottom()) { event.preventDefault(); that.select_next(); }; From 72c94c4f1c1ed779837c91f7596909bb2879f975 Mon Sep 17 00:00:00 2001 From: David Wyde Date: Tue, 2 Apr 2013 17:46:50 -0500 Subject: [PATCH 2/2] Fix an incorrect comment. --- IPython/frontend/html/notebook/static/js/notebook.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/IPython/frontend/html/notebook/static/js/notebook.js b/IPython/frontend/html/notebook/static/js/notebook.js index cd9e2b9f5..52c50cd43 100644 --- a/IPython/frontend/html/notebook/static/js/notebook.js +++ b/IPython/frontend/html/notebook/static/js/notebook.js @@ -1381,7 +1381,7 @@ var IPython = (function (IPython) { /** * Run the selected cell. * - * This executes code cells, and skips all others. + * Execute or render cell outputs. * * @method execute_selected_cell * @param {Object} options Customize post-execution behavior