Move progress contexts to bottom of output

This commit is contained in:
Marcus Holland-Moritz 2023-09-04 18:48:34 +02:00
parent 5f3209028d
commit 54e5723f01

View File

@ -240,20 +240,6 @@ void console_writer::update(progress& p, bool last) {
<< newline;
}
if (fancy) {
auto w = width.get();
if (w >= 60) {
ctxs = p.get_active_contexts();
}
for (auto const& c : ctxs) {
output_context_line(oss, *c, w, pg_mode_ == UNICODE,
log_is_colored());
oss << newline;
}
}
oss << p.dirs_scanned << " dirs, " << p.symlinks_scanned << "/"
<< p.hardlinks << " soft/hard links, " << p.files_scanned << "/"
<< p.files_found << " files, " << p.specials_found << " other"
@ -340,12 +326,23 @@ void console_writer::update(progress& p, bool last) {
log_stream() << oss.str();
}
} else {
oss << progress_bar(width.get() - 6, frac_, pg_mode_ == UNICODE)
auto w = width.get();
oss << progress_bar(w - 6, frac_, pg_mode_ == UNICODE)
<< fmt::format("{:3.0f}% ", 100 * frac_) << "-\\|/"[counter_ % 4]
<< '\n';
++counter_;
if (w >= 60) {
ctxs = p.get_active_contexts();
}
for (auto const& c : ctxs) {
output_context_line(oss, *c, w, pg_mode_ == UNICODE, log_is_colored());
oss << newline;
}
std::lock_guard lock(log_mutex());
rewind(8 + ctxs.size());