Ver Fonte

Merge pull request #624 from blink1073/advance-on-execute

Allow typeahead when executing notebook cells
Afshin Darian há 8 anos atrás
pai
commit
a1b516bed8
1 ficheiros alterados com 16 adições e 18 exclusões
  1. 16 18
      src/notebook/notebook/actions.ts

+ 16 - 18
src/notebook/notebook/actions.ts

@@ -364,16 +364,15 @@ namespace NotebookActions {
     if (!widget.model || !widget.activeCell) {
       return Promise.resolve(false);
     }
-    return run(widget, kernel).then(result => {
-      let model = widget.model;
-      if (widget.activeCellIndex === widget.childCount() - 1) {
-        let cell = model.factory.createCodeCell();
-        model.cells.add(cell);
-        widget.mode = 'edit';
-      }
-      widget.activeCellIndex++;
-      return result;
-    });
+    let promise = run(widget, kernel);
+    let model = widget.model;
+    if (widget.activeCellIndex === widget.childCount() - 1) {
+      let cell = model.factory.createCodeCell();
+      model.cells.add(cell);
+      widget.mode = 'edit';
+    }
+    widget.activeCellIndex++;
+    return promise;
   }
 
   /**
@@ -395,14 +394,13 @@ namespace NotebookActions {
     if (!widget.model || !widget.activeCell) {
       return Promise.resolve(false);
     }
-    return run(widget, kernel).then(result => {
-      let model = widget.model;
-      let cell = model.factory.createCodeCell();
-      model.cells.insert(widget.activeCellIndex + 1, cell);
-      widget.activeCellIndex++;
-      widget.mode = 'edit';
-      return result;
-    });
+    let promise = run(widget, kernel);
+    let model = widget.model;
+    let cell = model.factory.createCodeCell();
+    model.cells.insert(widget.activeCellIndex + 1, cell);
+    widget.activeCellIndex++;
+    widget.mode = 'edit';
+    return promise;
   }
 
   /**