@@ -13,6 +13,7 @@ import {
1313 OutputOptions ,
1414} from "./output.js" ;
1515import { enableSynchronousUpdates , disableSynchronousUpdates } from "./terminalSync.js" ;
16+ import { exitAlternateScreen , enterAlternateScreen } from "./screen.js" ;
1617import YAML from "yaml" ;
1718
1819export class CommandExecutor < T = unknown > {
@@ -56,7 +57,7 @@ export class CommandExecutor<T = unknown> {
5657
5758 // Exit alternate screen buffer
5859 disableSynchronousUpdates ( ) ;
59- process . stdout . write ( "\x1b[?1049l" ) ;
60+ exitAlternateScreen ( ) ;
6061 }
6162
6263 /**
@@ -78,7 +79,7 @@ export class CommandExecutor<T = unknown> {
7879
7980 // Interactive mode
8081 // Enter alternate screen buffer (this automatically clears the screen)
81- process . stdout . write ( "\x1b[?1049h" ) ;
82+ enterAlternateScreen ( ) ;
8283 enableSynchronousUpdates ( ) ;
8384
8485 const { waitUntilExit } = render ( renderUI ( ) , {
@@ -89,7 +90,7 @@ export class CommandExecutor<T = unknown> {
8990
9091 // Exit alternate screen buffer
9192 disableSynchronousUpdates ( ) ;
92- process . stdout . write ( "\x1b[?1049l" ) ;
93+ exitAlternateScreen ( ) ;
9394 }
9495
9596 /**
@@ -112,7 +113,7 @@ export class CommandExecutor<T = unknown> {
112113
113114 // Interactive mode
114115 // Enter alternate screen buffer
115- process . stdout . write ( "\x1b[?1049h" ) ;
116+ enterAlternateScreen ( ) ;
116117 enableSynchronousUpdates ( ) ;
117118
118119 const { waitUntilExit } = render ( renderUI ( ) , {
@@ -123,7 +124,7 @@ export class CommandExecutor<T = unknown> {
123124
124125 // Exit alternate screen buffer
125126 disableSynchronousUpdates ( ) ;
126- process . stdout . write ( "\x1b[?1049l" ) ;
127+ exitAlternateScreen ( ) ;
127128 }
128129
129130 /**
0 commit comments