crossterm
crossterm copied to clipboard
Make Windows clear the whole buffer and not only the visible part.
Task Description
If you call terminal.clear(ClearType::All) the whole buffer, the visible, and the invisible part should be cleared. This happens correctly on Linux, however, the winapi implementation only clears the visible buffer. The same as the command 'cls' works. The winai is used on windows versions <than 8.
Task Todo
Make terminal.clear(ClearType::All), clear the whole screen buffer instead of only the visible part.
- [ ] Figure out how to get the screen buffer dimensions, not the visible part, but also the invisible part.
- [ ] Replace the size here so that all screen contents are removed.
example

Can be closed since, this is not needed
Why it is not needed? I am trying to use crossterm on Windows 10 and terminal.clear(ClearType::All) behaves weird compared to cls.
Good question. The answer is not archived in my brain anymore. Let's reopen It until I know why ;)
Bump, I have this issue on Windows 10 while using tui
Only way to make the terminal.clear(ClearType::All) to clear the whole screenbuffer would require the usage of the legacy winapi instead of ANSI. And since modern unix terminals handle the ESC [2J inconsistently I don't think it should get handeled differently on windows.
One way to make it more consisten across all ANSI supporting terminals would be to use ESC [H before the ESC [2J to set the cursor at the top-left of the viewport before clearing.
Having the same issue on linux mint with gnome-terminal and alacritty. Adding another option (Purge for lack of a better name) as ANSI 3J seems to fix the issue for me
#591
@Termina94 Purge already is the name of a ClearType though. https://docs.rs/crossterm/0.21.0/crossterm/terminal/enum.ClearType.html#variant.Purge
@tobiasvl this was merged in August https://github.com/crossterm-rs/crossterm/pull/591#issuecomment-898381852
Only winapi logic has yet to be implemented