From 543b82567f5e0678e7a870624c5041488bffa777 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Wed, 20 Sep 2023 06:43:21 -0700 Subject: [PATCH] Don't re-render after parse is the viewport did not change Fixes #4814 --- src/common/InputHandler.ts | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/src/common/InputHandler.ts b/src/common/InputHandler.ts index afc41a3a..b5c91bfb 100644 --- a/src/common/InputHandler.ts +++ b/src/common/InputHandler.ts @@ -495,8 +495,13 @@ export class InputHandler extends Disposable implements IInputHandler { this._onCursorMove.fire(); } - // Refresh any dirty rows accumulated as part of parsing - this._onRequestRefreshRows.fire(this._dirtyRowTracker.start, this._dirtyRowTracker.end); + // Refresh any dirty rows accumulated as part of parsing, fire only for rows within the + // _viewport_ which is relative to ydisp, not relative to ybase. + const viewportEnd = this._dirtyRowTracker.end + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); + const viewportStart = this._dirtyRowTracker.start + (this._bufferService.buffer.ybase - this._bufferService.buffer.ydisp); + if (viewportStart < this._bufferService.rows) { + this._onRequestRefreshRows.fire(Math.min(viewportStart, this._bufferService.rows - 1), Math.min(viewportEnd, this._bufferService.rows - 1)); + } } public print(data: Uint32Array, start: number, end: number): void {