From 929150a8e139e790129f972147078867691a13b4 Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 21 Aug 2018 15:13:27 -0700 Subject: [PATCH] Prevent whole viewport from refreshing Fixes #1620 --- src/ui/RenderDebouncer.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/ui/RenderDebouncer.ts b/src/ui/RenderDebouncer.ts index ab88fb5f..23b575b7 100644 --- a/src/ui/RenderDebouncer.ts +++ b/src/ui/RenderDebouncer.ts @@ -22,11 +22,16 @@ export class RenderDebouncer implements IDisposable { } } - public refresh(rowStart?: number, rowEnd?: number): void { + public refresh(rowStart: number, rowEnd: number): void { + // Get the min/max row start/end for the arg values rowStart = rowStart || 0; rowEnd = rowEnd || this._terminal.rows - 1; - this._rowStart = this._rowStart !== undefined ? Math.min(this._rowStart, rowStart) : rowStart; - this._rowEnd = this._rowEnd !== undefined ? Math.max(this._rowEnd, rowEnd) : rowEnd; + // Check whether the row start/end values have already been set + const isRowStartSet = this._rowStart !== undefined && this._rowStart !== null; + const isRowEndSet = this._rowEnd !== undefined && this._rowEnd !== null; + // Set the properties to the updated values + this._rowStart = isRowStartSet ? Math.min(this._rowStart, rowStart) : rowStart; + this._rowEnd = isRowEndSet ? Math.max(this._rowEnd, rowEnd) : rowEnd; if (this._animationFrame) { return;