ソースを参照

More cleanup of activeCell logic

Steven Silvester 9 年 前
コミット
d959c751df
1 ファイル変更2 行追加2 行削除
  1. 2 2
      src/notebook/notebook/widget.ts

+ 2 - 2
src/notebook/notebook/widget.ts

@@ -600,12 +600,12 @@ class Notebook extends StaticNotebook {
   set activeCellIndex(newValue: number) {
     let oldValue = this._activeCellIndex;
     if (!this.model || !this.model.cells.length) {
-      this._activeCellIndex = -1;
+      newValue = -1;
     } else {
       newValue = Math.max(newValue, 0);
       newValue = Math.min(newValue, this.model.cells.length - 1);
-      this._activeCellIndex = newValue;
     }
+    this._activeCellIndex = newValue;
     let cell = this.childAt(newValue);
     if (cell !== this._activeCell) {
       this._activeCell = cell;