From c635cdabe81e34d2d206456c62f91b99adcf1952 Mon Sep 17 00:00:00 2001 From: Sude Date: Tue, 15 Nov 2016 19:50:00 +0200 Subject: [PATCH] Fix for extra characters in progress text in Website::getGames If we print shorter progress text than we printed earlier then characters from the earlier string would remain on the terminal because the line was not cleared. Clear the line before printing to avoid the extra characters. --- src/website.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/website.cpp b/src/website.cpp index 4f33395..0769968 100644 --- a/src/website.cpp +++ b/src/website.cpp @@ -157,7 +157,7 @@ std::vector Website::getGames() { for (unsigned int i = 0; i < root["products"].size(); ++i) { - std::cerr << "Getting game names " << "(" << root["page"].asInt() << "/" << root["totalPages"].asInt() << ") " << i+1 << " / " << root["products"].size() << "\r" << std::flush; + std::cerr << "\033[KGetting game names " << "(" << root["page"].asInt() << "/" << root["totalPages"].asInt() << ") " << i+1 << " / " << root["products"].size() << "\r" << std::flush; Json::Value product = root["products"][i]; gameItem game; game.name = product["slug"].asString();