From 118055d942f5bd66c85f22d42ee1219cc3410b70 Mon Sep 17 00:00:00 2001 From: Clement Roblot Date: Tue, 27 Aug 2024 21:16:04 +0700 Subject: [PATCH] Cleanup --- examples/component/selectable_input.cpp | 13 ++----------- src/ftxui/component/screen_interactive.cpp | 11 ----------- 2 files changed, 2 insertions(+), 22 deletions(-) diff --git a/examples/component/selectable_input.cpp b/examples/component/selectable_input.cpp index a3dcb23..807ef46 100644 --- a/examples/component/selectable_input.cpp +++ b/examples/component/selectable_input.cpp @@ -56,8 +56,6 @@ int main() { // Tweak how the component tree is rendered: auto renderer = Renderer(component, [&] { - textToCopy = screen.getSelection(); - return vbox({ hbox(text(" First name : "), input_first_name->Render()), hbox(text(" Last name : ") | selectable(), input_last_name->Render()), @@ -67,17 +65,10 @@ int main() { text("Hello " + first_name + " " + last_name), text("Your password is " + password), text("Your phone number is " + phoneNumber), - // text("select_start " + std::to_string(selection.startx) + ";" + std::to_string(selection.starty)), - // text("select_end " + std::to_string(selection.endx) + ";" + std::to_string(selection.endy)), - text("textToCopy is " + textToCopy) + text("Selected test is " + screen.getSelection()) }) | - border; // | selectable([&textToCopy](std::string txtSelected){textToCopy = txtSelected;}) + border; }); - // renderer |= CatchEvent([&](Event event) { - - // return selectableCatchEvent(event); - // }); - screen.Loop(renderer); } diff --git a/src/ftxui/component/screen_interactive.cpp b/src/ftxui/component/screen_interactive.cpp index d33b4f1..1d45535 100644 --- a/src/ftxui/component/screen_interactive.cpp +++ b/src/ftxui/component/screen_interactive.cpp @@ -841,10 +841,6 @@ void ScreenInteractive::HandleTask(Component component, Task& task) { bool ScreenInteractive::selectableCatchEvent(Event event) { - // std::ofstream MyFile("debug.log", std::ios_base::app); - // MyFile << "Top dog!" << std::endl; - // MyFile.close(); - if (event.is_mouse()) { auto& mouse = event.mouse(); if (mouse.button == Mouse::Left) { @@ -854,15 +850,12 @@ bool ScreenInteractive::selectableCatchEvent(Event event) { selectedRegion.starty = mouse.y; selectedRegion.endx = mouse.x; selectedRegion.endy = mouse.y; - // refreshSelection(); } else if (mouse.motion == Mouse::Released) { selectedRegion.endx = mouse.x; selectedRegion.endy = mouse.y; - // refreshSelection(); } else if (mouse.motion == Mouse::Moved) { selectedRegion.endx = mouse.x; selectedRegion.endy = mouse.y; - // refreshSelection(); } } } @@ -887,10 +880,6 @@ void ScreenInteractive::refreshSelection(void) { std::string ScreenInteractive::getSelection(void) { - // std::ofstream MyFile("debug.log", std::ios_base::app); - // MyFile << "Top dog!" << std::endl; - // MyFile.close(); - return selectedText; }