##// END OF EJS Templates
up and down keys no longer need special casing
Paul Ivanov -
Show More
@@ -174,28 +174,7 b' var IPython = (function (IPython) {'
174 // if this is an edit_shortcuts shortcut, we've already handled it.
174 // if this is an edit_shortcuts shortcut, we've already handled it.
175 if (shortcuts.use_shortcut(event)) { return true; }
175 if (shortcuts.use_shortcut(event)) { return true; }
176
176
177 if (event.keyCode === keycodes.enter && (event.shiftKey || event.ctrlKey || event.altKey)) {
177 if (event.which === keycodes.esc && event.type === 'keydown') {
178 // Always ignore shift-enter in CodeMirror as we handle it.
179 return true;
180 } else if (event.which === keycodes.up && event.type === 'keydown') {
181 // If we are not at the top, let CM handle the up arrow and
182 // prevent the global keydown handler from handling it.
183 if (!that.at_top()) {
184 event.stop();
185 return false;
186 } else {
187 return true;
188 };
189 } else if (event.which === keycodes.down && event.type === 'keydown') {
190 // If we are not at the bottom, let CM handle the down arrow and
191 // prevent the global keydown handler from handling it.
192 if (!that.at_bottom()) {
193 event.stop();
194 return false;
195 } else {
196 return true;
197 };
198 } else if (event.which === keycodes.esc && event.type === 'keydown') {
199 if (that.code_mirror.options.keyMap === "vim-insert") {
178 if (that.code_mirror.options.keyMap === "vim-insert") {
200 // vim keyMap is active and in insert mode. In this case we leave vim
179 // vim keyMap is active and in insert mode. In this case we leave vim
201 // insert mode, but remain in notebook edit mode.
180 // insert mode, but remain in notebook edit mode.
@@ -108,6 +108,11 b' var IPython = (function (IPython) {'
108 IPython.notebook.select_prev();
108 IPython.notebook.select_prev();
109 IPython.notebook.edit_mode();
109 IPython.notebook.edit_mode();
110 return false;
110 return false;
111 } else if (cell) {
112 var cm = cell.code_mirror
113 var cursor = cm.getCursor()
114 cursor.line -= 1
115 cm.setCursor(cursor);
111 }
116 }
112 }
117 }
113 }
118 }
@@ -125,6 +130,11 b' var IPython = (function (IPython) {'
125 IPython.notebook.select_next();
130 IPython.notebook.select_next();
126 IPython.notebook.edit_mode();
131 IPython.notebook.edit_mode();
127 return false;
132 return false;
133 } else if (cell) {
134 var cm = cell.code_mirror
135 var cursor = cm.getCursor()
136 cursor.line += 1
137 cm.setCursor(cursor);
128 }
138 }
129 }
139 }
130 }
140 }
General Comments 0
You need to be logged in to leave comments. Login now