You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The last line outputted to the terminal is overwritten when the spinner updates.
I've tracked it down to this line of code, https://github.com/oclif/core/blob/2.15.0/src/cli-ux/action/spinner.ts#L78, which uses ansi-escapes to move the cursor up and then erase everything underneath it. The underlying assumption is that it's moving the cursor to the beginning of the existing spinner, but that assumption fails once additional lines have been made to the terminal.
One potential solution is to use ansiEscapes.cursorSavePosition to capture the position of the cursor immediately after rendering the spinner and then use ansiEscapes.cursorRestorePosition to restore that position just before re-rendering it. I tested this and it did work until the spinner completed, at which point it cleared the additional logs. Maybe there's something to go off there.
To Reproduce
console.log('hello world 1')// this stays on the terminalux.action.start('starting spinner')console.log('hello world 2')// this stays on the terminalconsole.log('hello world 3')// this gets overwritten once spinner updatesawaitux.wait(2500)ux.action.status='still going'awaitux.wait(2500)ux.action.stop()
hello world 1
starting spinner...
hello world 2
starting spinner... done
The text was updated successfully, but these errors were encountered:
Describe the bug
The last line outputted to the terminal is overwritten when the spinner updates.
I've tracked it down to this line of code, https://github.com/oclif/core/blob/2.15.0/src/cli-ux/action/spinner.ts#L78, which uses ansi-escapes to move the cursor up and then erase everything underneath it. The underlying assumption is that it's moving the cursor to the beginning of the existing spinner, but that assumption fails once additional lines have been made to the terminal.
One potential solution is to use
ansiEscapes.cursorSavePosition
to capture the position of the cursor immediately after rendering the spinner and then useansiEscapes.cursorRestorePosition
to restore that position just before re-rendering it. I tested this and it did work until the spinner completed, at which point it cleared the additional logs. Maybe there's something to go off there.To Reproduce
The text was updated successfully, but these errors were encountered: