[progress_bar] Tidy up the appearance when at 100%

This commit is contained in:
Joe Thornber 2015-08-20 11:12:53 +01:00
parent 94636b63d7
commit 5f11f5af99

View File

@ -31,17 +31,22 @@ namespace {
if (nr_equals < progress_width_)
cout << '>';
else
cout << "=";
for (unsigned i = 0; i < nr_spaces; i++)
cout << ' ';
cout << "] " << spinner_char() << " " << p << "%\r" << flush;
cout << "] " << spinner_char(p) << " " << p << "%\r" << flush;
spinner_++;
}
private:
char spinner_char() const {
char spinner_char(unsigned p) const {
if (p == 100)
return ' ';
char cs[] = {'|', '/', '-', '\\'};
unsigned index = spinner_ % sizeof(cs);