Skip to content

Commit 4f07db0

Browse files
committed
use constant width in terminal
1 parent 0373926 commit 4f07db0

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

progress_bar.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,8 @@ ProgressBar::ProgressBar(uint64_t total,
5252
out = &out_;
5353

5454
if ((logging_mode_ = !to_terminal(*out)))
55-
*out << description_ + '\n' << std::flush;
55+
*out << description_ << std::endl;
5656

57-
assert(description_.size() <= kMessageSize);
5857
description_.resize(kMessageSize, ' ');
5958

6059
ShowProgress();
@@ -104,7 +103,7 @@ int ProgressBar::GetBarLength() const {
104103
- 9
105104
- description_.size()
106105
- kCharacterWidthPercentage
107-
- std::ceil(std::log10(std::max(uint64_t(1), total_))) * 2;
106+
- std::ceil(std::log10(std::max(uint64_t(2), total_))) * 4;
108107

109108
return std::min(max_size / 2, kMaxBarWidth);
110109
}

0 commit comments

Comments
 (0)