fix up and down arrows in the top and bottom cells

This commit is contained in:
Paul Ivanov 2014-03-17 20:11:33 -07:00
parent 09866e0ee1
commit 6d6e0fb007

View File

@ -100,9 +100,8 @@ var IPython = (function (IPython) {
help_index : '',
handler : function (event) {
var index = IPython.notebook.get_selected_index();
if (index !== null && index !== 0) {
var cell = IPython.notebook.get_cell(index);
if (cell && cell.at_top()) {
if (cell && cell.at_top() && index !== 0) {
event.preventDefault();
IPython.notebook.command_mode();
IPython.notebook.select_prev();
@ -118,16 +117,14 @@ var IPython = (function (IPython) {
return false;
}
}
}
},
'down' : {
help : '',
help_index : '',
handler : function (event) {
var index = IPython.notebook.get_selected_index();
if (index !== null && index !== (IPython.notebook.ncells()-1)) {
var cell = IPython.notebook.get_cell(index);
if (cell && cell.at_bottom()) {
if (cell.at_bottom() && index !== (IPython.notebook.ncells()-1)) {
event.preventDefault();
IPython.notebook.command_mode();
IPython.notebook.select_next();
@ -135,7 +132,7 @@ var IPython = (function (IPython) {
var cm = IPython.notebook.get_selected_cell().code_mirror;
cm.setCursor(0, 0);
return false;
} else if (cell) {
} else {
var cm = cell.code_mirror;
var cursor = cm.getCursor();
cursor.line += 1;
@ -143,7 +140,6 @@ var IPython = (function (IPython) {
return false;
}
}
}
},
'alt+-' : {
help : 'split cell',