CmdNews: Make it explicit enter has to be pressed to continue

This commit is contained in:
Tomas Babej 2021-09-27 22:04:10 -04:00
parent 506307fb87
commit e538e9199c

View file

@ -61,12 +61,14 @@ static void signal_handler (int s)
} }
} }
void wait_for_keypress () void wait_for_enter ()
{ {
signal (SIGINT, signal_handler); signal (SIGINT, signal_handler);
std::string dummy; std::string dummy;
std::cout << "\nPress enter to continue..";
std::getline (std::cin, dummy); std::getline (std::cin, dummy);
std::cout << "\33[2K\033[A\33[2K"; // Erase current line, move up, and erase again
signal (SIGINT, SIG_DFL); signal (SIGINT, SIG_DFL);
} }
@ -176,7 +178,7 @@ int CmdNews::execute (std::string& output)
for (unsigned short i=0; i < items.size (); i++) { for (unsigned short i=0; i < items.size (); i++) {
std::cout << format ("\n({1}/{2}) ", i+1, items.size ()); std::cout << format ("\n({1}/{2}) ", i+1, items.size ());
items[i].render (); items[i].render ();
wait_for_keypress (); wait_for_enter ();
} }
// Set a mark in the config to remember which version's release notes were displayed // Set a mark in the config to remember which version's release notes were displayed