diff --git a/src/common/strformat.h b/src/common/strformat.h index 1e65e5d6..a5e82e10 100644 --- a/src/common/strformat.h +++ b/src/common/strformat.h @@ -752,6 +752,16 @@ class string_formatter { { return format_pointer(val); } + void reset_format_params() + { + upper_ = false; + zero_padding_ = false; + align_left_ = false; + plus_ = false; + width_ = -1; + precision_ = -1; + lflag_ = 0; + } void format(std::function const &callback, int width, int precision) { if (advance(false)) { @@ -759,13 +769,7 @@ class string_formatter { next_++; } - upper_ = false; - zero_padding_ = false; - align_left_ = false; - plus_ = false; - width_ = -1; - precision_ = -1; - lflag_ = 0; + reset_format_params(); while (1) { int c = (unsigned char)*next_; @@ -851,6 +855,10 @@ class string_formatter { } head_ = next_; + } else { + reset_format_params(); + Part *p = callback('s'); + add_part(&list_, p); } } int length()