Add diagnostic logging for canvas/container dimensions

- Log canvas element and dimensions after terminal.open()
- Log container dimensions
- Log canvas state after fit() completes
- Helps debug blank terminal issues

v0.6.6
This commit is contained in:
GitHub Copilot
2026-01-28 09:46:26 +00:00
parent 8463b37e9e
commit d587a113a7
3 changed files with 37 additions and 5 deletions
File diff suppressed because one or more lines are too long
+32
View File
@@ -463,9 +463,41 @@ class WebTerminal {
/** Initialize event handlers and connect */
private initialize(): void {
console.log("[webterm:init] initialize() called");
// Check canvas state immediately
const canvas = this.element.querySelector("canvas");
console.log("[webterm:init] Canvas element:", canvas);
if (canvas) {
console.log("[webterm:init] Canvas dimensions:", {
width: canvas.width,
height: canvas.height,
clientWidth: canvas.clientWidth,
clientHeight: canvas.clientHeight,
style: canvas.style.cssText
});
}
console.log("[webterm:init] Container dimensions:", {
clientWidth: this.element.clientWidth,
clientHeight: this.element.clientHeight
});
// Wait for fonts to load before fitting to ensure correct measurements
this.waitForFonts().then(() => {
console.log("[webterm:init] Fonts loaded, calling fit()...");
this.fit();
console.log("[webterm:init] fit() completed");
// Check canvas state after fit
const canvasAfterFit = this.element.querySelector("canvas");
if (canvasAfterFit) {
console.log("[webterm:init] Canvas after fit:", {
width: canvasAfterFit.width,
height: canvasAfterFit.height,
clientWidth: canvasAfterFit.clientWidth,
clientHeight: canvasAfterFit.clientHeight
});
}
});
// Setup resize observer (we use our own fit method, not FitAddon's)