Description
🔎 Search Terms
ansi, terminal, watch, reset
🕗 Version & Regression Information
I run tsc --watch
in an iTerm2 terminal window for whatever project I'm working on, and I've been patching tsc
for a long time, and finally decided to bring this before the team.
Checking the log, looks like this ANSI sequence (x1Bc
) was committed via 08c6dc9 on Dec 2, 2017.
echo -e "\x1Bc"
does clear the screen, but the behaviour is not exactly well defined. In iTerm2, in particular, it pushes the scroll buffer off screen, but preserves it (you can scroll up to view the content).
echo -e "\x1Bc\x1B[3J"
OTOH clears the screen and explicitly clears the scroll buffer, which I think is the desired behaviour.
⏯ Playground Link
N/A
💻 Code
clearScreen: () => {
process.stdout.write("\x1Bc");
},
🙁 Actual behavior
In VSCode and Terminal, this sequence clears the screen and scroll buffer. In iTerm2 (and who knows where else – in searching for other examples, it's clear that other people also use this sequence, but I don't know which OSes)
🙂 Expected behavior
I expect tsc --watch
to clear the terminal and scroll history in all terminals.
Additional information about the issue
No response