Skip to content

Commit 40b3afd

Browse files
committed
cli: set useAlternateScreen: true
1 parent fde408c commit 40b3afd

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

cli/src/index.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -366,6 +366,7 @@ async function main(): Promise<void> {
366366
const renderer = await createCliRenderer({
367367
backgroundColor: 'transparent',
368368
exitOnCtrlC: false,
369+
useAlternateScreen: true,
369370
})
370371
installProcessCleanupHandlers(renderer)
371372
createRoot(renderer).render(

cli/src/utils/renderer-cleanup.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ let terminalStateReset = false
1212
* These are written directly to stdout to ensure they're sent even if the renderer is in a bad state.
1313
*
1414
* Sequences:
15+
* - \x1b[?1049l: Exit alternate screen buffer (restores main screen)
1516
* - \x1b[?1000l: Disable X10 mouse mode
1617
* - \x1b[?1002l: Disable button event mouse mode
1718
* - \x1b[?1003l: Disable any-event mouse mode (all motion tracking)
@@ -21,6 +22,7 @@ let terminalStateReset = false
2122
* - \x1b[?25h: Show cursor (safety measure)
2223
*/
2324
const TERMINAL_RESET_SEQUENCES =
25+
'\x1b[?1049l' + // Exit alternate screen buffer
2426
'\x1b[?1000l' + // Disable X10 mouse mode
2527
'\x1b[?1002l' + // Disable button event mouse mode
2628
'\x1b[?1003l' + // Disable any-event mouse mode (all motion)

0 commit comments

Comments
 (0)