Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tsc --watch uses "incomplete" ANSI sequence for "clear buffer" #57700

Open
colinta opened this issue Mar 8, 2024 · 5 comments
Open

tsc --watch uses "incomplete" ANSI sequence for "clear buffer" #57700

colinta opened this issue Mar 8, 2024 · 5 comments
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Milestone

Comments

@colinta
Copy link

colinta commented Mar 8, 2024

🔎 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

@jcalz
Copy link
Contributor

jcalz commented Mar 8, 2024

🙃 Duplicate of #57699

@jakebailey
Copy link
Member

#32351

@RyanCavanaugh RyanCavanaugh added Suggestion An idea for TypeScript Help Wanted You can do this Experience Enhancement Noncontroversial enhancements labels Mar 8, 2024
@RyanCavanaugh RyanCavanaugh added this to the Backlog milestone Mar 8, 2024
@jakebailey
Copy link
Member

I'm not sure this is always desirable, but I recall having a conversation about this on the discord quite recently. Not sure if it's a clear cut improvement, because you may really want to be able to scroll back up.

@colinta
Copy link
Author

colinta commented Mar 8, 2024 via email

@colinta
Copy link
Author

colinta commented Mar 8, 2024

I recall having a conversation about this on the discord quite recently.

But yeah that was me 😊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Experience Enhancement Noncontroversial enhancements Help Wanted You can do this Suggestion An idea for TypeScript
Projects
None yet
Development

No branches or pull requests

4 participants