Ensure viewport is correctly reset on term.reset

Part of #4603
This commit is contained in:
Daniel Imms
2023-08-02 11:18:00 -07:00
parent bb237f109a
commit acf53f69e0
4 changed files with 19 additions and 3 deletions
+13 -1
View File
@@ -81,13 +81,25 @@ export class Viewport extends Disposable implements IViewport {
this.register(this._optionsService.onSpecificOptionChange('scrollback', () => this.syncScrollArea()));
// Perform this async to ensure the ICharSizeService is ready.
setTimeout(() => this.syncScrollArea(), 0);
setTimeout(() => this.syncScrollArea());
}
private _handleThemeChange(colors: ReadonlyColorSet): void {
this._viewportElement.style.backgroundColor = colors.background.css;
}
public reset(): void {
this._currentRowHeight = 0;
this._currentDeviceCellHeight = 0;
this._lastRecordedBufferLength = 0;
this._lastRecordedViewportHeight = 0;
this._lastRecordedBufferHeight = 0;
this._lastTouchY = 0;
this._lastScrollTop = 0;
// Sync on next animation frame to ensure the new terminal state is used
this._coreBrowserService.window.requestAnimationFrame(() => this.syncScrollArea());
}
/**
* Refreshes row height, setting line-height, viewport height and scroll area height if
* necessary.