From 9a94abc31decb3115cd37b68df79a3c32037c1ad Mon Sep 17 00:00:00 2001 From: Clement Roblot Date: Tue, 26 Nov 2024 21:39:29 +0700 Subject: [PATCH] We can reverse select --- src/ftxui/dom/node.cpp | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/ftxui/dom/node.cpp b/src/ftxui/dom/node.cpp index 23191ff..6e0a12f 100644 --- a/src/ftxui/dom/node.cpp +++ b/src/ftxui/dom/node.cpp @@ -94,7 +94,21 @@ void Render(Screen& screen, Node* node, Box selection) { // Step 3: Selection std::vector selected; - node->Selection(selection, &selected); + + Box selectionCleaned = selection; + if(selection.x_min > selection.x_max) + { + selectionCleaned.x_min = selection.x_max; + selectionCleaned.x_max = selection.x_min; + } + + if(selection.y_min > selection.y_max) + { + selectionCleaned.y_min = selection.y_max; + selectionCleaned.y_max = selection.y_min; + } + + node->Selection(selectionCleaned, &selected); // Step 4: Draw the element. screen.stencil = box;