diff --git a/include/indicators/details/stream_helper.hpp b/include/indicators/details/stream_helper.hpp index 9e01e3f..2715c0b 100644 --- a/include/indicators/details/stream_helper.hpp +++ b/include/indicators/details/stream_helper.hpp @@ -136,21 +136,18 @@ public: std::ostream &write(float progress) { auto pos = static_cast(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 \ No newline at end of file