提交 a9aac120 编写于 作者: D Daniel Imms

Adopt clipboard service in terminal

上级 56f008e7
...@@ -607,12 +607,11 @@ export class TerminalPasteAction extends Action { ...@@ -607,12 +607,11 @@ export class TerminalPasteAction extends Action {
super(id, label); super(id, label);
} }
public run(event?: any): Promise<any> { public async run(event?: any): Promise<any> {
const instance = this.terminalService.getActiveOrCreateInstance(); const instance = this.terminalService.getActiveOrCreateInstance();
if (instance) { if (instance) {
instance.paste(); await instance.paste();
} }
return Promise.resolve(undefined);
} }
} }
......
...@@ -869,9 +869,9 @@ export class TerminalInstance implements ITerminalInstance { ...@@ -869,9 +869,9 @@ export class TerminalInstance implements ITerminalInstance {
return this._xtermReadyPromise.then(() => this.focus(force)); return this._xtermReadyPromise.then(() => this.focus(force));
} }
public paste(): void { public async paste(): Promise<void> {
this.focus(); this.focus();
document.execCommand('paste'); this._xterm._core._coreService.triggerDataEvent(await this._clipboardService.readText(), true);
} }
public write(text: string): void { public write(text: string): void {
......
...@@ -588,7 +588,7 @@ export interface ITerminalInstance { ...@@ -588,7 +588,7 @@ export interface ITerminalInstance {
/** /**
* Focuses and pastes the contents of the clipboard into the terminal instance. * Focuses and pastes the contents of the clipboard into the terminal instance.
*/ */
paste(): void; paste(): Promise<void>;
/** /**
* Send text to the terminal instance. The text is written to the stdin of the underlying pty * Send text to the terminal instance. The text is written to the stdin of the underlying pty
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册