提交 11d3e047 编写于 作者: D Daniel Imms

Focus terminal input if anywhere in panel is clicked

上级 a443f81f
......@@ -63,6 +63,11 @@ export class TerminalPanel extends Panel {
this.ptyProcess.write(data);
return false;
});
this.parentDomElement.addEventListener('mouseup', (event) => {
if (event.which !== 3) {
this.focusTerminal();
}
});
this.terminal.open(this.terminalDomElement);
this.parentDomElement.appendChild(terminalContainer.getDomNode());
......@@ -74,6 +79,16 @@ export class TerminalPanel extends Panel {
return TPromise.as(null);
}
private focusTerminal(): void {
let text = window.getSelection().toString();
if (!text) {
this.terminal.focus();
if (this.terminal._textarea) {
this.terminal._textarea.focus();
}
}
}
private getShell(): string {
let config = this.configurationService.getConfiguration<ITerminalConfiguration>();
if (platform.isWindows) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册