fix: fit addon proposing infinite dimensions

This commit is contained in:
Tony Brix
2020-09-10 12:31:27 -05:00
parent c112990d8f
commit 55571a1ae8
+4
View File
@@ -59,6 +59,10 @@ export class FitAddon implements ITerminalAddon {
// TODO: Remove reliance on private API
const core = (this._terminal as any)._core;
if (core._renderService.dimensions.actualCellWidth === 0 || core._renderService.dimensions.actualCellHeight === 0) {
return undefined;
}
const parentElementStyle = window.getComputedStyle(this._terminal.element.parentElement);
const parentElementHeight = parseInt(parentElementStyle.getPropertyValue('height'));
const parentElementWidth = Math.max(0, parseInt(parentElementStyle.getPropertyValue('width')));