From 52c8b1484346e19f82d1d61ca6b743721ec7463a Mon Sep 17 00:00:00 2001 From: stalin <stalin@tencent.com> Date: Fri, 30 Jul 2021 20:30:38 +0800 Subject: [PATCH] terminal: add mouse support of GUI terminal application , such as vim mouse mode and mc Application such as vim use binary message to indicate mouse event but not utf-8 data. In xterm.js, it be emitted by onBinary. Simplely connect it to send Data and resolved. Test environment: MacOS --- packages/terminal/src/browser/terminal-widget-impl.ts | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/packages/terminal/src/browser/terminal-widget-impl.ts b/packages/terminal/src/browser/terminal-widget-impl.ts index 89b051be547ba..b7a66b0d0609a 100644 --- a/packages/terminal/src/browser/terminal-widget-impl.ts +++ b/packages/terminal/src/browser/terminal-widget-impl.ts @@ -234,6 +234,10 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget this.onDataEmitter.fire(data); })); + this.toDispose.push(this.term.onBinary(data => { + this.onDataEmitter.fire(data); + })); + for (const contribution of this.terminalContributionProvider.getContributions()) { contribution.onCreate(this); } @@ -499,7 +503,10 @@ export class TerminalWidgetImpl extends TerminalWidget implements StatefulWidget } }; - const disposable = this.term.onData(sendData); + const disposable = new DisposableCollection; + disposable.push(this.term.onData(sendData)); + disposable.push(this.term.onBinary(sendData)); + connection.onDispose(() => disposable.dispose()); this.toDisposeOnConnect.push(connection);