Compare commits

...

2 Commits

Author SHA1 Message Date
Dmitry Nefedov
3830655b5b
Merge 3b01a5a0ad into 70bc44d28b 2024-11-14 09:28:24 +00:00
dangooddd
3b01a5a0ad Remove unused variable, allow clear on resize for Windows 2024-11-14 12:25:39 +03:00
2 changed files with 4 additions and 9 deletions

View File

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

View File

@ -858,15 +858,12 @@ void ScreenInteractive::Draw(Component component) {
ResetCursorPosition(); ResetCursorPosition();
std::cout << ResetPosition(/*clear=*/resized); std::cout << ResetPosition(/*clear=*/resized);
// clear terminal output if screen dimx decreases // If the terminal width decrease, the terminal emulator will start wrapping
// only on primary screen // lines and make the display dirty. We should clear it completely.
// only on POSIX systems (linux/macos) if ((dimx < dimx_) && !use_alternative_screen_) {
#if !defined(_WIN32) std::cout << "\033[J"; // clear terminal output
if ((dimx < dimx_) && validated_ && !use_alternative_screen_) {
std::cout << "\033[J"; // clear
std::cout << "\033[H"; // move cursor to home position std::cout << "\033[H"; // move cursor to home position
} }
#endif
// Resize the screen if needed. // Resize the screen if needed.
if (resized) { if (resized) {
@ -934,7 +931,6 @@ void ScreenInteractive::Draw(Component component) {
std::cout << ToString() << set_cursor_position; std::cout << ToString() << set_cursor_position;
Flush(); Flush();
Clear(); Clear();
validated_ = true;
frame_valid_ = true; frame_valid_ = true;
} }