diff --git a/index.js b/index.js index 1122cbf..f201915 100644 --- a/index.js +++ b/index.js @@ -78,6 +78,15 @@ x.scrollUp = ESC + 'S'; x.scrollDown = ESC + 'T'; x.clearScreen = '\u001Bc'; + +x.clearTerminal = process.platform === 'win32' ? + `${x.eraseScreen}${ESC}0f` : + // 1. Erases the screen (Only done in case `2` is not supported) + // 2. Erases the whole screen including scrollback buffer + // 3. Moves cursor to the top-left position + // More info: https://www.real-world-systems.com/docs/ANSIcode.html + `${x.eraseScreen}${ESC}3J${ESC}H`; + x.beep = BEL; x.link = (text, url) => { diff --git a/readme.md b/readme.md index 38b459f..513ef60 100644 --- a/readme.md +++ b/readme.md @@ -117,7 +117,11 @@ Scroll display down one line. ### clearScreen -Clear the terminal screen. +Clear the terminal screen. (Viewport) + +### clearTerminal + +Clear the whole terminal, including scrollback buffer. (Not just the visible part of it) ### beep