sindresorhus / ansi-escapes

ANSI escape codes for manipulating the terminal
MIT License
494 stars 44 forks source link

Add escapes for entering/exiting the alternative screen #33

Closed vadimdemedes closed 1 year ago

vadimdemedes commented 1 year ago

Fixes #32.

Script to test this with:

import ansiEscapes from './index.js';

console.log(ansiEscapes.enterAlternativeScreen)
console.log('Hello world')
await new Promise(resolve => setTimeout(resolve, 1000))
console.log(ansiEscapes.exitAlternativeScreen)

https://user-images.githubusercontent.com/697676/233954243-41195d66-2de5-44ca-8561-bf07eda31947.mp4

sindresorhus commented 1 year ago

https://github.com/sindresorhus/ansi-escapes/releases/tag/v6.2.0