Skip to content

Commit

Permalink
only run selected texts in a user terminal
Browse files Browse the repository at this point in the history
- The selected texts are only run in a user terminal.
  If the terminal widget that has the focus
  1) is not a user terminal, or
  2) is a user terminal that has an actively running command,
  Theia should create a new user terminal and run the selected texts in that new terminal.

- fixes #7323

Signed-off-by: Liang Huang <lhuang4@ualberta.ca>
  • Loading branch information
elaihau committed Apr 6, 2020
1 parent c4fed0d commit d96e6f1
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions packages/task/src/browser/task-service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -970,8 +970,8 @@ export class TaskService implements TaskConfigurationClient {
selectedRange = Range.create(startLine, 0, endLine + 1, 0);
}
const selectedText: string = this.editorManager.currentEditor.editor.document.getText(selectedRange).trimRight() + '\n';
let terminal = this.terminalService.currentTerminal;
if (!terminal) {
let terminal = this.terminalService.lastUsedTerminal;
if (!terminal || terminal.kind !== 'user' || (await terminal.hasChildProcesses())) {
terminal = <TerminalWidget>await this.terminalService.newTerminal(<TerminalWidgetFactoryOptions>{ created: new Date().toString() });
await terminal.start();
this.terminalService.activateTerminal(terminal);
Expand Down

0 comments on commit d96e6f1

Please sign in to comment.