Browse Source

Fix selected logic and update comment

Steven Silvester 7 years ago
parent
commit
0268b03052
1 changed files with 2 additions and 2 deletions
  1. 2 2
      packages/fileeditor-extension/src/index.ts

+ 2 - 2
packages/fileeditor-extension/src/index.ts

@@ -285,7 +285,7 @@ function activate(app: JupyterLab, restorer: ILayoutRestorer, editorServices: IE
 
   commands.addCommand(CommandIDs.runCode, {
     execute: () => {
-      // This will run the current selection or the entire ```fenced``` code block.
+      // Run the appropriate code, taking into account a ```fenced``` code block.
       const widget = tracker.currentWidget;
 
       if (!widget) {
@@ -313,10 +313,10 @@ function activate(app: JupyterLab, restorer: ILayoutRestorer, editorServices: IE
         for (let block of blocks) {
           if (block.startLine <= start.line && start.line <= block.endLine) {
             code = block.code;
+            selected = true;
             break;
           }
         }
-        selected = blocks.length > 0;
       }
 
       if (!selected) {