From 973eb7b350315f4cd004644b496305a685986711 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 11 May 2021 05:10:04 -0700 Subject: [PATCH 1/3] Make sure all rows are refreshed on input Fixes #3323 --- src/browser/Viewport.ts | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 02f74ce8..7b377a47 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -30,7 +30,6 @@ export class Viewport extends Disposable implements IViewport { private _wheelPartialScroll: number = 0; private _refreshAnimationFrame: number | null = null; - private _ignoreNextScrollEvent: boolean = false; constructor( private readonly _scrollLines: (amount: number) => void, @@ -88,14 +87,12 @@ export class Viewport extends Disposable implements IViewport { // Sync scrollTop const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight; if (this._viewportElement.scrollTop !== scrollTop) { - // Ignore the next scroll event which will be triggered by setting the scrollTop as we do not - // want this event to scroll the terminal - this._ignoreNextScrollEvent = true; this._viewportElement.scrollTop = scrollTop; } this._refreshAnimationFrame = null; } + /** * Updates dimensions and synchronizes the scroll area if necessary. */ @@ -148,12 +145,6 @@ export class Viewport extends Disposable implements IViewport { return; } - // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport) - if (this._ignoreNextScrollEvent) { - this._ignoreNextScrollEvent = false; - return; - } - const newRow = Math.round(this._lastScrollTop / this._currentRowHeight); const diff = newRow - this._bufferService.buffer.ydisp; this._scrollLines(diff); From da39129bd2cba926e7c7ef4d20d6154c685b6889 Mon Sep 17 00:00:00 2001 From: Daniel Imms <2193314+Tyriar@users.noreply.github.com> Date: Tue, 11 May 2021 05:10:04 -0700 Subject: [PATCH 2/3] Revert "Make sure all rows are refreshed on input" This reverts commit 973eb7b350315f4cd004644b496305a685986711. --- src/browser/Viewport.ts | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 7b377a47..02f74ce8 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -30,6 +30,7 @@ export class Viewport extends Disposable implements IViewport { private _wheelPartialScroll: number = 0; private _refreshAnimationFrame: number | null = null; + private _ignoreNextScrollEvent: boolean = false; constructor( private readonly _scrollLines: (amount: number) => void, @@ -87,12 +88,14 @@ export class Viewport extends Disposable implements IViewport { // Sync scrollTop const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight; if (this._viewportElement.scrollTop !== scrollTop) { + // Ignore the next scroll event which will be triggered by setting the scrollTop as we do not + // want this event to scroll the terminal + this._ignoreNextScrollEvent = true; this._viewportElement.scrollTop = scrollTop; } this._refreshAnimationFrame = null; } - /** * Updates dimensions and synchronizes the scroll area if necessary. */ @@ -145,6 +148,12 @@ export class Viewport extends Disposable implements IViewport { return; } + // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport) + if (this._ignoreNextScrollEvent) { + this._ignoreNextScrollEvent = false; + return; + } + const newRow = Math.round(this._lastScrollTop / this._currentRowHeight); const diff = newRow - this._bufferService.buffer.ydisp; this._scrollLines(diff); From bcbcc71bfc4e275d77703d724eb85a6152636acd Mon Sep 17 00:00:00 2001 From: Daniel Imms Date: Tue, 11 May 2021 06:52:04 -0700 Subject: [PATCH 3/3] Trigger scroll when ignoring event This is a less aggressive fix that doesn't regress tests --- src/browser/Viewport.ts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/browser/Viewport.ts b/src/browser/Viewport.ts index 02f74ce8..162ed174 100644 --- a/src/browser/Viewport.ts +++ b/src/browser/Viewport.ts @@ -151,6 +151,8 @@ export class Viewport extends Disposable implements IViewport { // Ignore the event if it was flagged to ignore (when the source of the event is from Viewport) if (this._ignoreNextScrollEvent) { this._ignoreNextScrollEvent = false; + // Still trigger the scroll so lines get refreshed + this._scrollLines(0); return; }