From d43bb02f7277f4337105d6abe6fe808e6d163f5d Mon Sep 17 00:00:00 2001 From: trilader Date: Sun, 22 Nov 2020 19:15:35 +0100 Subject: [PATCH] Fix get_selection: Allow the user to make a selection with the Enter key --- tui.cpp | 1 + 1 file changed, 1 insertion(+) diff --git a/tui.cpp b/tui.cpp index cc3402a..ee25fe1 100644 --- a/tui.cpp +++ b/tui.cpp @@ -183,6 +183,7 @@ int get_selection(const std::string &caption, const std::vector &en {TERMPAINT_EV_KEY, "ArrowUp", 0, [&](){ if(selected > 0) selected--; }, "Previous option"}, {TERMPAINT_EV_KEY, "ArrowDown", 0, [&](){ if(selected < entries.size() - 1) selected++; }, "Next option"}, {TERMPAINT_EV_KEY, "Escape", 0, [&](){ selected = -1; done = true; }, "Abort selection"}, + {TERMPAINT_EV_KEY, "Enter", 0, [&](){ done = true; }, "Confirm selection"}, {EV_IGNORE, "1..9", 0, nullptr, "Select option 1..9"}, };