File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -15,6 +15,12 @@ interface ErrorOptions {
1515 project ?: WorkspaceProject
1616}
1717
18+ const ESC = '\x1B['
19+ const ERASE_DOWN = `${ ESC } J`
20+ const ERASE_SCROLLBACK = `${ ESC } 3J`
21+ const CURSOR_TO_START = `${ ESC } 1;1H`
22+ const CLEAR_SCREEN = '\x1Bc'
23+
1824export class Logger {
1925 outputStream = process . stdout
2026 errorStream = process . stderr
@@ -50,7 +56,7 @@ export class Logger {
5056 return
5157 }
5258
53- this . console . log ( `\x1Bc ${ message } ` )
59+ this . console . log ( `${ ERASE_SCROLLBACK } ${ CLEAR_SCREEN } ${ message } ` )
5460 }
5561
5662 clearScreen ( message : string , force = false ) {
@@ -70,9 +76,7 @@ export class Logger {
7076
7177 const log = this . _clearScreenPending
7278 this . _clearScreenPending = undefined
73- // equivalent to ansi-escapes:
74- // stdout.write(ansiEscapes.cursorTo(0, 0) + ansiEscapes.eraseDown + log)
75- this . console . log ( `\u001B[1;1H\u001B[J${ log } ` )
79+ this . console . log ( `${ CURSOR_TO_START } ${ ERASE_DOWN } ${ log } ` )
7680 }
7781
7882 printError ( err : unknown , options : ErrorOptions = { } ) {
You can’t perform that action at this time.
0 commit comments