Clear terminal output of interactive screen if alternate screen not in

use
This commit is contained in:
dangooddd 2024-11-12 19:58:10 +03:00
parent 70bc44d28b
commit 09d36ccc9b
2 changed files with 9 additions and 0 deletions

View File

@ -121,6 +121,7 @@ class ScreenInteractive : public Screen {
bool mouse_captured = false;
bool previous_frame_resized_ = false;
bool validated_ = false;
bool frame_valid_ = false;
bool force_handle_ctrl_c_ = true;

View File

@ -858,6 +858,14 @@ void ScreenInteractive::Draw(Component component) {
ResetCursorPosition();
std::cout << ResetPosition(/*clear=*/resized);
// clear terminal output if non-fullscreen interactive screen dimx decreases
#if !defined(_WIN32)
if ((dimx < dimx_) && validated_ && !use_alternative_screen_) {
std::cout << "\033[J";
std::cout << "\033[H";
}
#endif
// Resize the screen if needed.
if (resized) {
dimx_ = dimx;