diff --git a/apps/frontend/src/renderer/components/terminal/usePtyProcess.ts b/apps/frontend/src/renderer/components/terminal/usePtyProcess.ts index 34b6c8d3..ad330d00 100644 --- a/apps/frontend/src/renderer/components/terminal/usePtyProcess.ts +++ b/apps/frontend/src/renderer/components/terminal/usePtyProcess.ts @@ -124,7 +124,7 @@ export function usePtyProcess({ // Normal skip (not during recreation) - just return if (skipCreation) { - debugLog(`[usePtyProcess] Skipping PTY creation for terminal: ${terminalId} - dimensions not ready (skipCreation=true)`); + debugLog(`[usePtyProcess] Skipping PTY creation for terminal: ${terminalId} - dimensions not ready`); return; } if (isCreatingRef.current || isCreatedRef.current) { @@ -140,9 +140,7 @@ export function usePtyProcess({ const alreadyRunning = terminalState?.status === 'running' || terminalState?.status === 'claude-active'; const isRestored = terminalState?.isRestored; - debugLog(`[usePtyProcess] Starting PTY creation for terminal: ${terminalId}`); - debugLog(`[usePtyProcess] Terminal ${terminalId} state: isRestored=${isRestored}, status=${terminalState?.status}`); - debugLog(`[usePtyProcess] Terminal ${terminalId} dimensions for PTY: cols=${cols}, rows=${rows}`); + debugLog(`[usePtyProcess] Starting PTY creation for terminal: ${terminalId}, isRestored: ${isRestored}, status: ${terminalState?.status}, cols: ${cols}, rows: ${rows}`); // When recreating (e.g., worktree switching), reset status from 'exited' to 'idle' // This allows proper recreation after deliberate terminal destruction diff --git a/apps/frontend/src/renderer/components/terminal/useXterm.ts b/apps/frontend/src/renderer/components/terminal/useXterm.ts index a5d4a709..54ea08dc 100644 --- a/apps/frontend/src/renderer/components/terminal/useXterm.ts +++ b/apps/frontend/src/renderer/components/terminal/useXterm.ts @@ -5,12 +5,18 @@ import { WebLinksAddon } from '@xterm/addon-web-links'; import { SerializeAddon } from '@xterm/addon-serialize'; import { terminalBufferManager } from '../../lib/terminal-buffer-manager'; import { registerOutputCallback, unregisterOutputCallback } from '../../stores/terminal-store'; -import { useTerminalFontSettingsStore } from '../../stores/terminal-font-settings-store'; -import { isWindows as checkIsWindows, isLinux as checkIsLinux } from '../../lib/os-detection'; -import { debounce } from '../../lib/debounce'; -import { DEFAULT_TERMINAL_THEME } from '../../lib/terminal-theme'; import { debugLog, debugError } from '../../../shared/utils/debug-logger'; +// Type augmentation for navigator.userAgentData (modern User-Agent Client Hints API) +interface NavigatorUAData { + platform: string; +} +declare global { + interface Navigator { + userAgentData?: NavigatorUAData; + } +} + interface UseXtermOptions { terminalId: string; onCommandEnter?: (command: string) => void; @@ -72,13 +78,6 @@ export function useXterm({ terminalId, onCommandEnter, onResize, onDimensionsRea return; } - // Reset refs when (re)initializing xterm - // This is critical for React StrictMode which unmounts/remounts components, - // causing dispose() to set isDisposedRef.current = true on the first unmount. - // Without this reset, the remounted component would still have isDisposed = true. - isDisposedRef.current = false; - dimensionsReadyCalledRef.current = false; - debugLog(`[useXterm] Initializing xterm for terminal: ${terminalId}`); const xterm = new XTerm({ @@ -249,7 +248,7 @@ export function useXterm({ terminalId, onCommandEnter, onResize, onDimensionsRea // Call onDimensionsReady once when we have valid dimensions if (!dimensionsReadyCalledRef.current && cols > 0 && rows > 0) { dimensionsReadyCalledRef.current = true; - debugLog(`[useXterm] Dimensions ready for terminal: ${terminalId}, cols: ${cols}, rows: ${rows}, containerWidth: ${rect.width}, containerHeight: ${rect.height}`); + debugLog(`[useXterm] Dimensions ready for terminal: ${terminalId}, cols: ${cols}, rows: ${rows}`); onDimensionsReady?.(cols, rows); } } else { diff --git a/apps/frontend/src/shared/i18n/locales/en/terminal.json b/apps/frontend/src/shared/i18n/locales/en/terminal.json index 7d87ea7d..d9f1bdf3 100644 --- a/apps/frontend/src/shared/i18n/locales/en/terminal.json +++ b/apps/frontend/src/shared/i18n/locales/en/terminal.json @@ -5,8 +5,7 @@ }, "resume": { "pending": "Resume Available", - "pendingTooltip": "Click to resume previous Claude session", - "resumeAllSessions": "Resume All" + "pendingTooltip": "Click to resume previous Claude session" }, "auth": { "terminalTitle": "Auth: {{profileName}}", diff --git a/apps/frontend/src/shared/i18n/locales/fr/terminal.json b/apps/frontend/src/shared/i18n/locales/fr/terminal.json index a13c0ab0..d1aa1289 100644 --- a/apps/frontend/src/shared/i18n/locales/fr/terminal.json +++ b/apps/frontend/src/shared/i18n/locales/fr/terminal.json @@ -5,8 +5,7 @@ }, "resume": { "pending": "Reprise disponible", - "pendingTooltip": "Cliquez pour reprendre la session Claude précédente", - "resumeAllSessions": "Reprendre Tout" + "pendingTooltip": "Cliquez pour reprendre la session Claude précédente" }, "auth": { "terminalTitle": "Auth: {{profileName}}",