mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2025-09-17 08:28:09 +08:00
Clear terminal on resize. (#99)
This commit is contained in:
@@ -382,11 +382,6 @@ void ScreenInteractive::Loop(Component component) {
|
||||
// The main loop.
|
||||
while (!quit_) {
|
||||
if (!event_receiver_->HasPending()) {
|
||||
std::cout << reset_cursor_position << ResetPosition();
|
||||
static int i = -2;
|
||||
if (i % 10 == 0)
|
||||
std::cout << DeviceStatusReport(DSRMode::kCursor);
|
||||
++i;
|
||||
Draw(component);
|
||||
std::cout << ToString() << set_cursor_position;
|
||||
Flush();
|
||||
@@ -442,8 +437,11 @@ void ScreenInteractive::Draw(Component component) {
|
||||
break;
|
||||
}
|
||||
|
||||
bool resized = (dimx != dimx_) || (dimy != dimy_);
|
||||
std::cout << reset_cursor_position << ResetPosition(/*clear=*/resized);
|
||||
|
||||
// Resize the screen if needed.
|
||||
if (dimx != dimx_ || dimy != dimy_) {
|
||||
if (resized) {
|
||||
dimx_ = dimx;
|
||||
dimy_ = dimy;
|
||||
pixels_ = std::vector<std::vector<Pixel>>(dimy, std::vector<Pixel>(dimx));
|
||||
@@ -451,6 +449,11 @@ void ScreenInteractive::Draw(Component component) {
|
||||
cursor_.y = dimy_ - 1;
|
||||
}
|
||||
|
||||
static int i = -2;
|
||||
if (i % 10 == 0)
|
||||
std::cout << DeviceStatusReport(DSRMode::kCursor);
|
||||
++i;
|
||||
|
||||
Render(*this, document);
|
||||
|
||||
// Set cursor position for user using tools to insert CJK characters.
|
||||
|
Reference in New Issue
Block a user