This commit is contained in:
Dmitry Nefedov 2024-11-13 07:39:42 +00:00 committed by GitHub
commit 566c9b3b64
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 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,16 @@ void ScreenInteractive::Draw(Component component) {
ResetCursorPosition();
std::cout << ResetPosition(/*clear=*/resized);
// clear terminal output if screen dimx decreases
// only on primary screen
// only on POSIX systems (linux/macos)
#if !defined(_WIN32)
if ((dimx < dimx_) && validated_ && !use_alternative_screen_) {
std::cout << "\033[J"; // clear
std::cout << "\033[H"; // move cursor to home position
}
#endif
// Resize the screen if needed.
if (resized) {
dimx_ = dimx;
@ -924,6 +934,7 @@ void ScreenInteractive::Draw(Component component) {
std::cout << ToString() << set_cursor_position;
Flush();
Clear();
validated_ = true;
frame_valid_ = true;
}