The alternate screen is a separate text buffer that many terminal emulators implement. It functions like the main terminal screen, but applications can write to it freely without worrying about clearing the user’s prompt.
Alternate screen buffers are essential for implementing TUIs such as games, text editors or any other application that wants to print to the full terminal screen without disrupting the user’s main terminal window and prompt.
Here’s an example of printing an updating counter to the alternate screen in Rust using crossterm: