Remove redundancies

This commit is contained in:
Georg Hagen
2025-01-04 03:21:55 +01:00
parent ca93036f31
commit 450f1170b4
7 changed files with 58 additions and 100 deletions

View File

@@ -29,27 +29,12 @@ int main(int argc, char** argv)
int selectedExample = 0;
ftxui::MenuOption option;
auto screen = ftxui::ScreenInteractive::TerminalOutput();
screen.ForceHandleCtrlC(true);
//screen.ForceHandleCtrlZ(true);
option.on_enter = screen.ExitLoopClosure();
auto menu = ftxui::Menu(&examples, &selectedExample, option);
bool shouldExit = false;
menu |= ftxui::CatchEvent(
[&](ftxui::Event event)
{
if (event == ftxui::Event::CtrlC || event == ftxui::Event::CtrlZ)
{
screen.ExitLoopClosure()();
shouldExit = true;
}
return false;
});
bool shouldExit = true;
option.on_enter = [&] { shouldExit = false; screen.ExitLoopClosure(); };
screen.Loop(menu);
if (shouldExit)
{
return 0;
}
if (shouldExit) return 0;
if (selectedExample >= examples.size())
{