diff --git a/src/ftxui/dom/text.cpp b/src/ftxui/dom/text.cpp index 678c064..f5188d5 100644 --- a/src/ftxui/dom/text.cpp +++ b/src/ftxui/dom/text.cpp @@ -67,17 +67,14 @@ class Text : public Node { } screen.PixelAt(x, y).character = cell; + if (has_selection) { + if((x >= selection_start_) && (x <= selection_end_)) { + screen.PixelAt(x, y).inverted = true; + } + } + ++x; } - - if (!has_selection) { - return; - } - - // Invert the selection - for(int x = selection_start_; x <= selection_end_; x++) { - screen.PixelAt(x, y).inverted = true; - } } private: