Skip to content

Commit 5deb4cf

Browse files
authored
Merge pull request #2 from PierrunoYT/copilot/fix-terminal-resizing-issue
Fix terminal resize on Windows PowerShell
2 parents 8d33c52 + 0f35907 commit 5deb4cf

File tree

1 file changed

+19
-2
lines changed

1 file changed

+19
-2
lines changed

cli/src/index.tsx

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -300,11 +300,28 @@ async function main(): Promise<void> {
300300
backgroundColor: 'transparent',
301301
exitOnCtrlC: false,
302302
})
303-
createRoot(renderer).render(
303+
304+
const root = createRoot(renderer)
305+
306+
// React component tree to render
307+
const app = (
304308
<QueryClientProvider client={queryClient}>
305309
<AppWithAsyncAuth />
306-
</QueryClientProvider>,
310+
</QueryClientProvider>
307311
)
312+
313+
// Add resize event listener for terminal resize support on Windows PowerShell
314+
// On Windows, the SIGWINCH signal may not fire reliably, so we listen to
315+
// process.stdout 'resize' event to ensure the UI updates when the window is resized
316+
if (process.stdout.isTTY) {
317+
process.stdout.on('resize', () => {
318+
// Re-render the React tree to update with new terminal dimensions
319+
root.render(app)
320+
})
321+
}
322+
323+
// Initial render
324+
root.render(app)
308325
}
309326

310327
void main()

0 commit comments

Comments
 (0)