mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-27 13:48:51 +08:00
Compare commits
1 Commits
3830655b5b
...
566c9b3b64
Author | SHA1 | Date | |
---|---|---|---|
|
566c9b3b64 |
@ -121,6 +121,7 @@ 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;
|
||||||
|
@ -858,12 +858,15 @@ void ScreenInteractive::Draw(Component component) {
|
|||||||
ResetCursorPosition();
|
ResetCursorPosition();
|
||||||
std::cout << ResetPosition(/*clear=*/resized);
|
std::cout << ResetPosition(/*clear=*/resized);
|
||||||
|
|
||||||
// If the terminal width decrease, the terminal emulator will start wrapping
|
// clear terminal output if screen dimx decreases
|
||||||
// lines and make the display dirty. We should clear it completely.
|
// only on primary screen
|
||||||
if ((dimx < dimx_) && !use_alternative_screen_) {
|
// only on POSIX systems (linux/macos)
|
||||||
std::cout << "\033[J"; // clear terminal output
|
#if !defined(_WIN32)
|
||||||
|
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) {
|
||||||
@ -931,6 +934,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user