mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-08-12 11:26:38 +08:00
Clear terminal output of interactive screen if alternate screen not in
use
This commit is contained in:
parent
70bc44d28b
commit
09d36ccc9b
@ -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,6 +858,14 @@ void ScreenInteractive::Draw(Component component) {
|
|||||||
ResetCursorPosition();
|
ResetCursorPosition();
|
||||||
std::cout << ResetPosition(/*clear=*/resized);
|
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.
|
// Resize the screen if needed.
|
||||||
if (resized) {
|
if (resized) {
|
||||||
dimx_ = dimx;
|
dimx_ = dimx;
|
||||||
|
Loading…
Reference in New Issue
Block a user