diff --git a/src/components/shell/view/Shell.tsx b/src/components/shell/view/Shell.tsx index 575b0ac34b..e264472de4 100644 --- a/src/components/shell/view/Shell.tsx +++ b/src/components/shell/view/Shell.tsx @@ -165,7 +165,11 @@ export default function Shell({ } const focusTerminal = () => { - terminalRef.current?.focus(); + const term = terminalRef.current; + if (!term) return; + const savedViewport = term.buffer.active.viewportY; + term.focus(); + term.scrollToLine(savedViewport); }; const animationFrameId = window.requestAnimationFrame(focusTerminal);