Merge pull request #3126 from dwyde/arrow-keys-empty-notebook

Prevent errors when pressing arrow keys in an empty notebook

Notebook.get_selected_cell() returns null in an empty notebook.
Min RK 13 years ago
commit 88b45a76e4

@ -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();
};
@ -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

Loading…
Cancel
Save