Revert "Make sure all rows are refreshed on input"

This reverts commit 973eb7b350.
This commit is contained in:
Daniel Imms
2021-05-11 06:48:17 -07:00
committed by Daniel Imms
parent 973eb7b350
commit da39129bd2
+10 -1
View File
@@ -30,6 +30,7 @@ export class Viewport extends Disposable implements IViewport {
private _wheelPartialScroll: number = 0; private _wheelPartialScroll: number = 0;
private _refreshAnimationFrame: number | null = null; private _refreshAnimationFrame: number | null = null;
private _ignoreNextScrollEvent: boolean = false;
constructor( constructor(
private readonly _scrollLines: (amount: number) => void, private readonly _scrollLines: (amount: number) => void,
@@ -87,12 +88,14 @@ export class Viewport extends Disposable implements IViewport {
// Sync scrollTop // Sync scrollTop
const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight; const scrollTop = this._bufferService.buffer.ydisp * this._currentRowHeight;
if (this._viewportElement.scrollTop !== scrollTop) { 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._viewportElement.scrollTop = scrollTop;
} }
this._refreshAnimationFrame = null; this._refreshAnimationFrame = null;
} }
/** /**
* Updates dimensions and synchronizes the scroll area if necessary. * Updates dimensions and synchronizes the scroll area if necessary.
*/ */
@@ -145,6 +148,12 @@ export class Viewport extends Disposable implements IViewport {
return; 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 newRow = Math.round(this._lastScrollTop / this._currentRowHeight);
const diff = newRow - this._bufferService.buffer.ydisp; const diff = newRow - this._bufferService.buffer.ydisp;
this._scrollLines(diff); this._scrollLines(diff);