Merge pull request #87999 from microsoft/tyriar/85257

Flush all buffered data events on terminal close
This commit is contained in:
Daniel Imms
2020-01-06 10:50:05 -08:00
committed by GitHub
5 changed files with 136 additions and 108 deletions

View File

@@ -343,7 +343,7 @@ class TerminalDataEventTracker extends Disposable {
) {
super();
this._register(this._bufferer = new TerminalDataBufferer());
this._register(this._bufferer = new TerminalDataBufferer(this._callback));
this._terminalService.terminalInstances.forEach(instance => this._registerInstance(instance));
this._register(this._terminalService.onInstanceCreated(instance => this._registerInstance(instance)));
@@ -352,6 +352,6 @@ class TerminalDataEventTracker extends Disposable {
private _registerInstance(instance: ITerminalInstance): void {
// Buffer data events to reduce the amount of messages going to the extension host
this._register(this._bufferer.startBuffering(instance.id, instance.onData, this._callback));
this._register(this._bufferer.startBuffering(instance.id, instance.onData));
}
}

View File

@@ -310,9 +310,8 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
constructor(
@IExtHostRpcService extHostRpc: IExtHostRpcService
) {
this._bufferer = new TerminalDataBufferer();
this._proxy = extHostRpc.getProxy(MainContext.MainThreadTerminalService);
this._bufferer = new TerminalDataBufferer(this._proxy.$sendProcessData);
this._onDidWriteTerminalData = new Emitter<vscode.TerminalDataWriteEvent>({
onFirstListenerAdd: () => this._proxy.$startSendingDataEvents(),
onLastListenerRemove: () => this._proxy.$stopSendingDataEvents()
@@ -477,7 +476,7 @@ export abstract class BaseExtHostTerminalService implements IExtHostTerminalServ
p.onProcessTitleChanged(title => this._proxy.$sendProcessTitle(id, title));
// Buffer data events to reduce the amount of messages going to the renderer
this._bufferer.startBuffering(id, p.onProcessData, this._proxy.$sendProcessData);
this._bufferer.startBuffering(id, p.onProcessData);
p.onProcessExit(exitCode => this._onProcessExit(id, exitCode));
if (p.onProcessOverrideDimensions) {