##// END OF EJS Templates
fix up and down arrows in the top and bottom cells
Paul Ivanov -
Show More
@@ -100,23 +100,21 b' var IPython = (function (IPython) {'
100 100 help_index : '',
101 101 handler : function (event) {
102 102 var index = IPython.notebook.get_selected_index();
103 if (index !== null && index !== 0) {
104 var cell = IPython.notebook.get_cell(index);
105 if (cell && cell.at_top()) {
106 event.preventDefault();
107 IPython.notebook.command_mode();
108 IPython.notebook.select_prev();
109 IPython.notebook.edit_mode();
110 var cm = IPython.notebook.get_selected_cell().code_mirror;
111 cm.setCursor(cm.lastLine(), 0);
112 return false;
113 } else if (cell) {
114 var cm = cell.code_mirror;
115 var cursor = cm.getCursor();
116 cursor.line -= 1;
117 cm.setCursor(cursor);
118 return false;
119 }
103 var cell = IPython.notebook.get_cell(index);
104 if (cell && cell.at_top() && index !== 0) {
105 event.preventDefault();
106 IPython.notebook.command_mode();
107 IPython.notebook.select_prev();
108 IPython.notebook.edit_mode();
109 var cm = IPython.notebook.get_selected_cell().code_mirror;
110 cm.setCursor(cm.lastLine(), 0);
111 return false;
112 } else if (cell) {
113 var cm = cell.code_mirror;
114 var cursor = cm.getCursor();
115 cursor.line -= 1;
116 cm.setCursor(cursor);
117 return false;
120 118 }
121 119 }
122 120 },
@@ -125,23 +123,21 b' var IPython = (function (IPython) {'
125 123 help_index : '',
126 124 handler : function (event) {
127 125 var index = IPython.notebook.get_selected_index();
128 if (index !== null && index !== (IPython.notebook.ncells()-1)) {
129 var cell = IPython.notebook.get_cell(index);
130 if (cell && cell.at_bottom()) {
131 event.preventDefault();
132 IPython.notebook.command_mode();
133 IPython.notebook.select_next();
134 IPython.notebook.edit_mode();
135 var cm = IPython.notebook.get_selected_cell().code_mirror;
136 cm.setCursor(0, 0);
137 return false;
138 } else if (cell) {
139 var cm = cell.code_mirror;
140 var cursor = cm.getCursor();
141 cursor.line += 1;
142 cm.setCursor(cursor);
143 return false;
144 }
126 var cell = IPython.notebook.get_cell(index);
127 if (cell.at_bottom() && index !== (IPython.notebook.ncells()-1)) {
128 event.preventDefault();
129 IPython.notebook.command_mode();
130 IPython.notebook.select_next();
131 IPython.notebook.edit_mode();
132 var cm = IPython.notebook.get_selected_cell().code_mirror;
133 cm.setCursor(0, 0);
134 return false;
135 } else {
136 var cm = cell.code_mirror;
137 var cursor = cm.getCursor();
138 cursor.line += 1;
139 cm.setCursor(cursor);
140 return false;
145 141 }
146 142 }
147 143 },
General Comments 0
You need to be logged in to leave comments. Login now