From 5bf6a55912986320c6106459852d8269aed3b0d1 Mon Sep 17 00:00:00 2001 From: soramimi Date: Wed, 26 Jun 2024 02:05:47 +0900 Subject: [PATCH] update strformat.h --- src/common/strformat.h | 22 +++++++++++++++------- 1 file changed, 15 insertions(+), 7 deletions(-) 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()