Enhance terminal readiness checks with comprehensive FitAddon validation

- Added more robust terminal readiness checking
- Explicitly check for viewport.scrollBarWidth being defined
- Added FitAddon function type checking before calling fit()
- Improved error handling for FitAddon initialization issues
- Prevents 'undefined is not an object' errors during terminal setup
- Maintains all existing functionality and test compatibility

Bump version to 0.3.29

Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
GitHub Copilot
2026-01-28 00:35:21 +00:00
parent fae80d308a
commit 35aa0c0968
3 changed files with 73 additions and 14 deletions
+28 -5
View File
@@ -14551,8 +14551,12 @@ class WebTerminal {
this.resizeState.isResizing = true;
this.resizeState.resizeAttempts++;
this.lastResizeTime = now;
this.fitAddon.fit();
this.resizeState.resizeAttempts = 0;
if (this.fitAddon && typeof this.fitAddon.fit === "function") {
this.fitAddon.fit();
this.resizeState.resizeAttempts = 0;
} else {
throw new Error("FitAddon not properly initialized");
}
} catch (e) {
console.warn("Fit failed:", e);
this.handleResizeFailure();
@@ -14576,21 +14580,40 @@ class WebTerminal {
}
isTerminalReady() {
try {
if (!this.terminal || !this.terminal._core) {
if (!this.terminal) {
return false;
}
if (!this.terminal._core) {
return false;
}
const core = this.terminal._core;
if (!core.viewport || !core.viewport.scrollBarWidth) {
if (!core.viewport) {
return false;
}
if (core.viewport.scrollBarWidth === undefined) {
return false;
}
if (!core._renderService) {
return false;
}
const renderService = core._renderService;
if (!renderService || !renderService.dimensions) {
if (!renderService.dimensions) {
return false;
}
const dims = renderService.dimensions;
if (dims.css.cell.width === 0 || dims.css.cell.height === 0) {
return false;
}
if (this.fitAddon) {
try {
const fitTerminal = this.fitAddon._terminal;
if (!fitTerminal || fitTerminal !== this.terminal) {
return false;
}
} catch (e) {
return false;
}
}
return true;
} catch (e) {
console.warn("Terminal readiness check failed:", e);