From ab9d6feaa5addf185a84b5a4494d7bd04abe9519 Mon Sep 17 00:00:00 2001 From: Arthur Sonzogni Date: Mon, 17 May 2021 01:34:53 +0200 Subject: [PATCH] Fix separator() (#100) separator() should modify only the character, not the background color. --- src/ftxui/dom/separator.cpp | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/ftxui/dom/separator.cpp b/src/ftxui/dom/separator.cpp index 2751d62..dda48ad 100644 --- a/src/ftxui/dom/separator.cpp +++ b/src/ftxui/dom/separator.cpp @@ -29,15 +29,9 @@ class Separator : public Node { else c = U'│'; - Pixel p; - p.character = c; - RenderWithPixel(screen, p); - } - - void RenderWithPixel(Screen& screen, Pixel pixel) { for (int y = box_.y_min; y <= box_.y_max; ++y) { for (int x = box_.x_min; x <= box_.x_max; ++x) { - screen.PixelAt(x, y) = pixel; + screen.PixelAt(x, y).character = c; } } } @@ -47,7 +41,13 @@ class SeparatorWithPixel : public Separator { public: SeparatorWithPixel(Pixel pixel) : pixel_(pixel) {} ~SeparatorWithPixel() override {} - void Render(Screen& screen) override { RenderWithPixel(screen, pixel_); } + void Render(Screen& screen) override { + for (int y = box_.y_min; y <= box_.y_max; ++y) { + for (int x = box_.x_min; x <= box_.x_max; ++x) { + screen.PixelAt(x, y) = pixel_; + } + } + } private: Pixel pixel_;