mirror of
https://github.com/p-ranav/indicators.git
synced 2025-12-16 04:18:51 +08:00
Reverted minor changes to stream helper w.r.t checking if fill, lead and remainder are empty
This commit is contained in:
@@ -136,21 +136,18 @@ public:
|
||||
|
||||
std::ostream &write(float progress) {
|
||||
auto pos = static_cast<size_t>(progress * bar_width / 100.0);
|
||||
for (size_t i = 0; i < bar_width;) {
|
||||
std::string next{""};
|
||||
size_t current_display_width = 0;
|
||||
for (size_t i = 0, current_display_width = 0; i < bar_width;) {
|
||||
std::string next;
|
||||
|
||||
if (i < pos && !fill.empty()) {
|
||||
if (i < pos) {
|
||||
next = fill;
|
||||
current_display_width = unicode::display_width(fill);
|
||||
} else if (i == pos && !lead.empty()) {
|
||||
} else if (i == pos) {
|
||||
next = lead;
|
||||
current_display_width = unicode::display_width(lead);
|
||||
} else {
|
||||
if (!remainder.empty()) {
|
||||
next = remainder;
|
||||
current_display_width = unicode::display_width(remainder);
|
||||
}
|
||||
next = remainder;
|
||||
current_display_width = unicode::display_width(remainder);
|
||||
}
|
||||
|
||||
i += current_display_width;
|
||||
@@ -218,4 +215,4 @@ private:
|
||||
};
|
||||
|
||||
} // namespace details
|
||||
} // namespace indicators
|
||||
} // namespace indicators
|
||||
Reference in New Issue
Block a user