浏览代码

Editor submit unselected line to console

Chris 7 年之前
父节点
当前提交
aed48dca29
共有 1 个文件被更改,包括 9 次插入0 次删除
  1. 9 0
      packages/fileeditor-extension/src/index.ts

+ 9 - 0
packages/fileeditor-extension/src/index.ts

@@ -316,6 +316,15 @@ function activate(app: JupyterLab, restorer: ILayoutRestorer, editorServices: IE
             break;
           }
         }
+      } else {
+        // no selection, submit whole line and advance
+        code = editor.getLine(selection.start.line);
+        const cursor = editor.getCursorPosition();
+        if (cursor.line + 1 == editor.lineCount) {
+          let text = editor.model.value.text;
+          editor.model.value.text = text + '\n';
+        }
+        editor.setCursorPosition({ line: cursor.line + 1, column: cursor.column });
       }
 
       const activate = false;