From 182aca649064bb54e8d00ac02e6667ee7702d0bb Mon Sep 17 00:00:00 2001 From: Asher Date: Thu, 19 Nov 2020 10:58:04 -0600 Subject: [PATCH] Only replay terminals when detached --- ci/dev/vscode.patch | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/ci/dev/vscode.patch b/ci/dev/vscode.patch index 949bed3f..7bf38f34 100644 --- a/ci/dev/vscode.patch +++ b/ci/dev/vscode.patch @@ -1466,10 +1466,10 @@ index 0000000000000000000000000000000000000000..6ce56bec114a6d8daf5dd3ded945ea78 +} diff --git a/src/vs/server/node/channel.ts b/src/vs/server/node/channel.ts new file mode 100644 -index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b3319cc9b +index 0000000000000000000000000000000000000000..b65bf283739a2b05c82fe38a038d2a10957c0d40 --- /dev/null +++ b/src/vs/server/node/channel.ts -@@ -0,0 +1,828 @@ +@@ -0,0 +1,848 @@ +import { field, logger } from '@coder/logger'; +import { Server } from '@coder/node-browser'; +import * as os from 'os'; @@ -1893,6 +1893,7 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b + private readonly maxReplayData = 10000; + private totalReplayData = 0; + ++ private detached = false; + private buffering = false; + private readonly _onEvent = new Emitter({ + // Don't bind to data until something is listening. @@ -1906,10 +1907,11 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b + + // Replay stored events. + onFirstListenerDidAdd: () => { -+ if (this.replayData.length === 0) { ++ if (!this.detached) { + return; + } + ++ this.detached = false; + logger.debug('Terminal replaying', field('id', this.id)); + this._onEvent.fire({ + type: 'replay', @@ -1922,6 +1924,7 @@ index 0000000000000000000000000000000000000000..cb3a45fda10a6bcbff73275b5734641b + }, + + onLastListenerRemove: () => { ++ this.detached = true; + logger.debug('Terminal unbound', field('id', this.id)); + if (!this.persist) { // Used by debug consoles. + this.dispose();