Remove flickering. (#95)

For some reason, ResetPosition() was also clearing the content. On very
slow terminal emulator like the one on Windows, flickering was visible.

This fixes:
https://github.com/ArthurSonzogni/FTXUI/issues/86
This commit is contained in:
Arthur Sonzogni 2021-05-16 10:59:19 +02:00 committed by GitHub
parent ca0d74ac01
commit 01f5d9f7bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -36,7 +36,6 @@ static const wchar_t* INVERTED_RESET = L"\x1B[27m";
static const char* MOVE_LEFT = "\r";
static const char* MOVE_UP = "\x1B[1A";
static const char* CLEAR_LINE = "\x1B[2K";
bool In(const Box& stencil, int x, int y) {
return stencil.x_min <= x && x <= stencil.x_max && //
@ -222,9 +221,9 @@ Pixel& Screen::PixelAt(int x, int y) {
/// beginning.
std::string Screen::ResetPosition() {
std::stringstream ss;
ss << MOVE_LEFT << CLEAR_LINE;
ss << MOVE_LEFT;
for (int y = 1; y < dimy_; ++y) {
ss << MOVE_UP << CLEAR_LINE;
ss << MOVE_UP;
}
return ss.str();
}