Skip to content

Commit e47a097

Browse files
committed
fix: ensure terminal properly resizes after startup script failure
This change fixes a bug where the web terminal doesn't fit the screen properly when a startup script fails, causing text at the bottom of the terminal to be hidden. The solution adds a delayed second call to fitAddon.fit() after alert changes to ensure proper terminal sizing. Fixes #46
1 parent aacb11d commit e47a097

1 file changed

Lines changed: 9 additions & 1 deletion

File tree

site/src/pages/TerminalPage/TerminalPage.tsx

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,15 @@ const TerminalPage: FC = () => {
343343
agent={workspaceAgent}
344344
status={connectionStatus}
345345
onAlertChange={() => {
346+
// First fit might not calculate correctly, apply a small delay and fit again
346347
fitAddonRef.current?.fit();
348+
349+
// Apply a second fit after a small delay to ensure terminal size is correct
350+
// This fixes the issue where text at the bottom of the terminal is hidden
351+
// when startup scripts fail
352+
setTimeout(() => {
353+
fitAddonRef.current?.fit();
354+
}, 100);
347355
}}
348356
/>
349357
<div
@@ -400,4 +408,4 @@ const styles = {
400408
}),
401409
} satisfies Record<string, Interpolation<Theme>>;
402410

403-
export default TerminalPage;
411+
export default TerminalPage;

0 commit comments

Comments
 (0)