Sfoglia il codice sorgente

Re-order activeCell check

Jeremy Tuloup 5 anni fa
parent
commit
c036b1f9fc
1 ha cambiato i file con 11 aggiunte e 9 eliminazioni
  1. 11 9
      src/handlers/cell.ts

+ 11 - 9
src/handlers/cell.ts

@@ -48,21 +48,23 @@ export class CellManager implements IDisposable {
   isDisposed: boolean;
 
   private showCurrentLine(lineNumber: number) {
-    if (this.activeCell) {
-      const editor = this.activeCell.editor as CodeMirrorEditor;
-      this.cleanupHighlight();
-      editor.editor.addLineClass(lineNumber - 1, 'wrap', LINE_HIGHLIGHT_CLASS);
+    if (!this.activeCell) {
+      return;
     }
+    const editor = this.activeCell.editor as CodeMirrorEditor;
+    this.cleanupHighlight();
+    editor.editor.addLineClass(lineNumber - 1, 'wrap', LINE_HIGHLIGHT_CLASS);
   }
 
   // TODO: call when the debugger stops
   private cleanupHighlight() {
-    if (this.activeCell) {
-      const editor = this.activeCell.editor as CodeMirrorEditor;
-      editor.doc.eachLine(line => {
-        editor.editor.removeLineClass(line, 'wrap', LINE_HIGHLIGHT_CLASS);
-      });
+    if (!this.activeCell) {
+      return;
     }
+    const editor = this.activeCell.editor as CodeMirrorEditor;
+    editor.doc.eachLine(line => {
+      editor.editor.removeLineClass(line, 'wrap', LINE_HIGHLIGHT_CLASS);
+    });
   }
 
   dispose(): void {