Skip to content

Commit cc225b9

Browse files
committed
log cleanup and fixes
1 parent 8bfa3e5 commit cc225b9

File tree

3 files changed

+8
-26
lines changed

3 files changed

+8
-26
lines changed

src/main/services/shell.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,6 @@ export function registerShellIpc(): void {
6262
pty: ptyProcess,
6363
webContents: event.sender,
6464
});
65-
66-
console.log(`Created shell session ${sessionId} with shell: ${shell}`);
6765
} catch (error) {
6866
console.error(`Failed to create shell session ${sessionId}:`, error);
6967
throw error;
@@ -117,7 +115,6 @@ export function registerShellIpc(): void {
117115

118116
session.pty.kill();
119117
sessions.delete(sessionId);
120-
console.log(`Destroyed shell session ${sessionId}`);
121118
},
122119
);
123120
}

src/renderer/components/TabBar.tsx

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,6 @@ export function TabBar({ onOpenCommandMenu }: TabBarProps) {
5656
}, [tabs, activeTabId, setActiveTab]);
5757

5858
const handleCloseTab = useCallback(() => {
59-
console.log("Closing tab");
6059
if (tabs.length > 1) {
6160
closeTab(activeTabId);
6261
}

src/renderer/features/terminal/components/ShellTerminal.tsx

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -45,24 +45,15 @@ export function ShellTerminal({ cwd }: ShellTerminalProps) {
4545
}, [cliMode]);
4646

4747
useEffect(() => {
48-
console.log("[ShellTerminal] Effect running", {
49-
hasRef: !!terminalRef.current,
50-
hasTerminal: !!terminal.current,
51-
});
52-
5348
if (!terminalRef.current) {
54-
console.log("[ShellTerminal] No terminalRef, returning");
5549
return;
5650
}
5751

5852
// Don't recreate if already exists
5953
if (terminal.current) {
60-
console.log("[ShellTerminal] Terminal already exists, returning");
6154
return;
6255
}
6356

64-
console.log("[ShellTerminal] Creating terminal...");
65-
6657
// Generate unique session ID for this effect run using cryptographically secure random
6758
const sessionId = `shell-${Date.now()}-${secureRandomString(7)}`;
6859
sessionIdRef.current = sessionId;
@@ -115,13 +106,15 @@ export function ShellTerminal({ cwd }: ShellTerminalProps) {
115106
// Open terminal
116107
term.open(terminalRef.current);
117108

118-
// Fit terminal to container
119-
fit.fit();
120-
121109
// Store refs
122110
terminal.current = term;
123111
fitAddon.current = fit;
124112

113+
// Fit terminal to container after it's fully initialized
114+
setTimeout(() => {
115+
fit.fit();
116+
}, 0);
117+
125118
// Create PTY session
126119
window.electronAPI?.shellCreate(sessionId, cwd).catch((error: Error) => {
127120
console.error("Failed to create shell session:", error);
@@ -152,25 +145,21 @@ export function ShellTerminal({ cwd }: ShellTerminalProps) {
152145

153146
// Handle resize
154147
const handleResize = () => {
155-
if (fit && term) {
156-
fit.fit();
148+
if (fitAddon.current && terminal.current) {
149+
fitAddon.current.fit();
157150
window.electronAPI
158-
?.shellResize(sessionId, term.cols, term.rows)
151+
?.shellResize(sessionId, terminal.current.cols, terminal.current.rows)
159152
.catch((error: Error) => {
160153
console.error("Failed to resize shell:", error);
161154
});
162155
}
163156
};
164157

165-
// Initial resize
166-
handleResize();
167-
168158
// Listen for window resize
169159
window.addEventListener("resize", handleResize);
170160

171161
// Cleanup
172162
return () => {
173-
console.log("[ShellTerminal] Cleanup running, disposing terminal");
174163
window.removeEventListener("resize", handleResize);
175164
disposable.dispose();
176165
unsubscribeData?.();
@@ -181,9 +170,6 @@ export function ShellTerminal({ cwd }: ShellTerminalProps) {
181170
term.dispose();
182171
terminal.current = null;
183172
fitAddon.current = null;
184-
console.log(
185-
"[ShellTerminal] Cleanup complete, terminal.current set to null",
186-
);
187173
};
188174
}, [cwd, setCliMode]);
189175

0 commit comments

Comments
 (0)