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:
GitHub Copilot
2026-01-28 00:42:23 +00:00
parent 8ee6f2d605
commit 712cc72911
3 changed files with 9 additions and 3 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
[tool.poetry]
name = "textual-webterm"
version = "0.3.31"
version = "0.3.32"
description = "Serve terminal sessions over the web"
authors = ["Will McGugan <will@textualize.io>"]
license = "MIT"
File diff suppressed because one or more lines are too long
+7 -1
View File
@@ -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 = (() => {