mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-22 18:59:59 +08:00
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:
parent
ca0d74ac01
commit
01f5d9f7bc
@ -36,7 +36,6 @@ static const wchar_t* INVERTED_RESET = L"\x1B[27m";
|
|||||||
|
|
||||||
static const char* MOVE_LEFT = "\r";
|
static const char* MOVE_LEFT = "\r";
|
||||||
static const char* MOVE_UP = "\x1B[1A";
|
static const char* MOVE_UP = "\x1B[1A";
|
||||||
static const char* CLEAR_LINE = "\x1B[2K";
|
|
||||||
|
|
||||||
bool In(const Box& stencil, int x, int y) {
|
bool In(const Box& stencil, int x, int y) {
|
||||||
return stencil.x_min <= x && x <= stencil.x_max && //
|
return stencil.x_min <= x && x <= stencil.x_max && //
|
||||||
@ -222,9 +221,9 @@ Pixel& Screen::PixelAt(int x, int y) {
|
|||||||
/// beginning.
|
/// beginning.
|
||||||
std::string Screen::ResetPosition() {
|
std::string Screen::ResetPosition() {
|
||||||
std::stringstream ss;
|
std::stringstream ss;
|
||||||
ss << MOVE_LEFT << CLEAR_LINE;
|
ss << MOVE_LEFT;
|
||||||
for (int y = 1; y < dimy_; ++y) {
|
for (int y = 1; y < dimy_; ++y) {
|
||||||
ss << MOVE_UP << CLEAR_LINE;
|
ss << MOVE_UP;
|
||||||
}
|
}
|
||||||
return ss.str();
|
return ss.str();
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user