Fix proposeDimensions error: skip call when terminal not ready
When terminal is not ready after max attempts, go directly to fallback dimensions instead of falling through to call proposeDimensions() which throws 'viewport.scrollBarWidth' TypeError. Root cause: FitAddon.proposeDimensions() checks _renderService.dimensions before accessing viewport.scrollBarWidth, but dimensions can be valid while viewport is still undefined during terminal initialization.
This commit is contained in:
File diff suppressed because one or more lines are too long
@@ -360,7 +360,13 @@ class WebTerminal {
|
||||
window.requestAnimationFrame(() => attemptFitAndResize(attempt + 1));
|
||||
return;
|
||||
}
|
||||
// Fall through to use fallback dimensions
|
||||
// Terminal not ready after max attempts - use fallback directly
|
||||
// Don't call proposeDimensions() as it will throw
|
||||
console.warn("Terminal not ready after max attempts, using fallback dimensions");
|
||||
this.terminal.resize(fallback.cols, fallback.rows);
|
||||
this.resizeState.lastValidSize = fallback;
|
||||
this.send(["resize", { width: fallback.cols, height: fallback.rows }]);
|
||||
return;
|
||||
}
|
||||
|
||||
const dims = (() => {
|
||||
|
||||
Reference in New Issue
Block a user