From ae697ff2f4b9af8f4acd0fbebbe5fb6c7d342810 Mon Sep 17 00:00:00 2001 From: uroma Date: Mon, 19 Jan 2026 19:27:19 +0000 Subject: [PATCH] debug: add switchToTerminal logging and fitAddon error handling - Log when switchToTerminal is called and if terminal is in map - Log fitAddon.fit() execution with error handling - Log when switchToTerminal completes This will help identify if switchToTerminal is causing the WebSocket closure --- database.sqlite-shm | Bin 32768 -> 32768 bytes database.sqlite-wal | Bin 881712 -> 931152 bytes public/claude-ide/terminal.js | 19 ++++++++++++++++++- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/database.sqlite-shm b/database.sqlite-shm index 14aecaa6214e6b1f7cb827db9558b6cb942694da..cf04ed7655c7e479b7024a9cf7a77af96cfcbd46 100644 GIT binary patch delta 202 zcmZo@U}|V!s+V}A%K!o_K+MR%An*uCa{_Vdg*3L86>Oq=Q)4ztca$7Y?DmM9|N3n| zsp^47fdRF7M2#)7Pc1l7LFFq7OocV7M?A<1|`#PTw)a9V0v&O?D%7y z-IE0-N(+iJFfeceF)I)=19A9dn~BDZ;@eLsGi~7Ki0RB~;7d8hwmqSUQ9yt*oz*hM zyVIVBYx}`XjQj!|H+EhrNs>*wvwgxOpfpF+$4N83f16;AVK5WW;0UO}8Yv)y^Acia zo!RM^wEe&)kk0Zg_m%F&%I?~J;}D4JyNThO*~hP^FbrY@8WagNs9*}vAkL+^pOnNn zZyCUxWV=Nn>e}Ix3$`nK2ARaMUF>h|{le`iCIJlrgD9v;Gnhe6VoSS_D#}*za(RF- GlK=oqC}qt6 delta 35 qcmccc%3{L{(}ott7N!>F7M2#)7Pc1l7LFFq7OocV7M?A<1| { c.classList.remove('active'); @@ -1159,13 +1161,27 @@ class TerminalManager { // Initialize xterm.js if not already done if (!this.terminals.has(terminalId)) { + this.debugLog('INIT', `Terminal ${terminalId} NOT in map, calling initializeXTerm...`); await this.initializeXTerm(terminalId); + } else { + this.debugLog('INIT', `Terminal ${terminalId} already in map, skipping initialization`); } // Fit terminal const terminal = this.terminals.get(terminalId); if (terminal && terminal.fitAddon) { - setTimeout(() => terminal.fitAddon.fit(), 100); + this.debugLog('INIT', `Calling fitAddon.fit() for ${terminalId} in 100ms...`); + setTimeout(() => { + this.debugLog('INIT', `Executing fitAddon.fit() for ${terminalId}`); + try { + terminal.fitAddon.fit(); + this.debugLog('INIT', `fitAddon.fit() completed for ${terminalId}`); + } catch (error) { + this.debugLog('ERROR', `fitAddon.fit() failed for ${terminalId}`, { error: error.message }); + } + }, 100); + } else { + this.debugLog('INIT', `No fitAddon for terminal ${terminalId} (terminal=${!!terminal}, fitAddon=${!!terminal?.fitAddon})`); } } @@ -1175,6 +1191,7 @@ class TerminalManager { tab.classList.add('active'); } + this.debugLog('INIT', `switchToTerminal completed for ${terminalId}`); this.activeTerminalId = terminalId; }