Remove redundancies
This commit is contained in:
@@ -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())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user