Skip to content

an open-source alternative to the dots, bots and muses of the world, run an office of claude code/codex like agents on your laptop, sandboxes or anywhere, uses your existing subscriptions

fix(terminal): snap to latest output on agent switch

Chaitanya Giri80f00ce79dc3
diff --git a/src/renderer/src/components/PtyTerminalView.tsx b/src/renderer/src/components/PtyTerminalView.tsx
index cc7eddfa..55b9c3b1 100644
--- a/src/renderer/src/components/PtyTerminalView.tsx
+++ b/src/renderer/src/components/PtyTerminalView.tsx
@@ -141,6 +141,9 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
entry.onData = (chunk) => onStreamDataRef.current?.(chunk);
entry.onPrompt = (text) => onUserPromptRef.current?.(text);
+ // Snap to bottom immediately on re-attach before fit settles
+ try { entry.term.scrollToBottom(); } catch { /* not yet open */ }
+
// `scrollToEnd` is true only for the initial attach (switching agents /
// toggling fullscreen) so we land on the most recent output. Re-parenting
// the pooled terminal resets its viewport to the top otherwise. Later
@@ -151,8 +154,10 @@ export function PtyTerminalView({ ptyId, onStreamData, onUserPrompt, onToggleFul
entry.fit.fit();
window.cth.resizePty(ptyId, entry.term.cols, entry.term.rows);
entry.term.refresh(0, Math.max(0, entry.term.rows - 1));
- if (scrollToEnd) entry.term.scrollToBottom();
} catch { /* host may not be sized yet */ }
+ if (scrollToEnd) {
+ try { entry.term.scrollToBottom(); } catch { /* noop */ }
+ }
};
// Fit once layout has settled and again once the web font has loaded —
// these are the initial-attach fits, so snap to the bottom.