diff --git a/tabby-terminal/src/frontends/xtermFrontend.ts b/tabby-terminal/src/frontends/xtermFrontend.ts index 5a577ddf..29c17e4d 100644 --- a/tabby-terminal/src/frontends/xtermFrontend.ts +++ b/tabby-terminal/src/frontends/xtermFrontend.ts @@ -39,13 +39,14 @@ class FlowControl { this.bytesWritten += data.length if (this.bytesWritten > this.bytesThreshold) { this.pendingCallbacks++ - if (this.pendingCallbacks > this.highWatermark) { + this.bytesWritten = 0 + if (!this.blocked && this.pendingCallbacks > this.highWatermark) { this.blocked = true this.blocked$.next(true) } this.xterm.write(data, () => { this.pendingCallbacks-- - if (this.pendingCallbacks < this.lowWatermark) { + if (this.blocked && this.pendingCallbacks < this.lowWatermark) { this.blocked = false this.blocked$.next(false) }