File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change @@ -490,15 +490,16 @@ static void print_progress(size_t current, size_t total) {
490490
491491 static std::mutex mutex;
492492 static std::map<std::thread::id, int > lines;
493+ static int max_line = 0 ;
493494
494495 std::lock_guard<std::mutex> lock (mutex);
495496 std::thread::id id = std::this_thread::get_id ();
496497
497498 if (lines.find (id) == lines.end ()) {
498- lines[id] = lines. size () ;
499+ lines[id] = max_line++ ;
499500 std::cout << " \n " ;
500501 }
501- int lines_up = lines. size () - lines[id];
502+ int lines_up = max_line - lines[id];
502503
503504 size_t width = 50 ;
504505 size_t pct = (100 * current) / total;
@@ -519,6 +520,13 @@ static void print_progress(size_t current, size_t total) {
519520 << " \033 [u" ;
520521
521522 std::cout.flush ();
523+
524+ if (current == total) {
525+ lines.erase (id);
526+ if (lines.empty ()) {
527+ max_line = 0 ;
528+ }
529+ }
522530}
523531
524532static bool common_pull_file (httplib::Client & cli,
You can’t perform that action at this time.
0 commit comments