From 907e1463859e1c6126cb372e90314b0d302ae3d3 Mon Sep 17 00:00:00 2001 From: Clement Roblot Date: Tue, 26 Nov 2024 21:47:01 +0700 Subject: [PATCH] Correct the title highlighting of hbox grabing to top border --- src/ftxui/dom/text.cpp | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) 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: