Browse Source

Clean up code

Roshan Prabhakar 8 years ago
parent
commit
41aed34097
1 changed files with 6 additions and 10 deletions
  1. 6 10
      src/notebook/codemirror/cells/editor.ts

+ 6 - 10
src/notebook/codemirror/cells/editor.ts

@@ -251,22 +251,18 @@ class CodeMirrorCellEditorWidget extends CodeMirrorWidget implements ICellEditor
     }
 
     // If the shift key is pressed, don't move to top cell
-    if (event.shiftKey === false) {
-      if (line === 0 && ch === 0 && event.keyCode === UP_ARROW) {
-        this.edgeRequested.emit('top');
-        return;
-      }
+    if (line === 0 && ch === 0 && event.keyCode === UP_ARROW && event.shiftKey === false) {
+      this.edgeRequested.emit('top');
+      return;
     }
 
     let lastLine = doc.lastLine();
     let lastCh = doc.getLineHandle(lastLine).text.length;
     
     // If the shift key is pressed, don't move to bottom cell
-    if (event.shiftKey === false) {
-      if (line === lastLine && ch === lastCh && event.keyCode === DOWN_ARROW) {
-        this.edgeRequested.emit('bottom');
-        return;
-      }
+    if (line === lastLine && ch === lastCh && event.keyCode === DOWN_ARROW && event.shiftKey === false) {
+      this.edgeRequested.emit('bottom');
+      return;
     }
   }