From 01f5d9f7bcc441f3e188d6f83c125c75f5c823fc Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Sun, 16 May 2021 10:59:19 +0200 Subject: [PATCH] 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 --- src/ftxui/screen/screen.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/ftxui/screen/screen.cpp b/src/ftxui/screen/screen.cpp index 5a3dbd19..110fd6b3 100644 --- a/src/ftxui/screen/screen.cpp +++ b/src/ftxui/screen/screen.cpp @@ -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(); }