From 92586f76bc4aa494c185ab20aeb8210455c3ccc7 Mon Sep 17 00:00:00 2001 From: Clement Roblot Date: Thu, 31 Oct 2024 21:34:53 +0700 Subject: [PATCH] More intuitive selection of text --- src/ftxui/dom/text.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ftxui/dom/text.cpp b/src/ftxui/dom/text.cpp index 08de9317..1415191c 100644 --- a/src/ftxui/dom/text.cpp +++ b/src/ftxui/dom/text.cpp @@ -50,14 +50,14 @@ class Text : public Node { currentPixel.inverted ^= true; screen.selection_text += currentPixel.character; } - else if(screen.selection_region.x_min <= x && screen.selection_region.x_max <= x && - screen.selection_region.y_min <= y && screen.selection_region.y_max > y) + else if((x >= screen.selection_region.x_min) && (x >= screen.selection_region.x_max) && + (y >= screen.selection_region.y_min) && (y < screen.selection_region.y_max)) { currentPixel.inverted ^= true; screen.selection_text += currentPixel.character; } - else if(screen.selection_region.x_min >= x && screen.selection_region.x_max >= x && - screen.selection_region.y_min < y && screen.selection_region.y_max >= y) + else if((x <= screen.selection_region.x_min) && (x <= screen.selection_region.x_max) && + (y > screen.selection_region.y_min) && (y <= screen.selection_region.y_max)) { currentPixel.inverted ^= true; screen.selection_text += currentPixel.character;