diff --git a/include/fmt/color.h b/include/fmt/color.h index 3756ba3f..96d9ab6b 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -412,7 +412,7 @@ template struct ansi_color_escape { FMT_CONSTEXPR const Char* begin() const FMT_NOEXCEPT { return buffer; } FMT_CONSTEXPR const Char* end() const FMT_NOEXCEPT { - return buffer + std::strlen(buffer); + return buffer + std::char_traits::length(buffer); } private: diff --git a/test/color-test.cc b/test/color-test.cc index fde3a0c5..c1113a2e 100644 --- a/test/color-test.cc +++ b/test/color-test.cc @@ -50,6 +50,8 @@ TEST(ColorsTest, ColorsPrint) { TEST(ColorsTest, Format) { EXPECT_EQ(fmt::format(fg(fmt::rgb(255, 20, 30)), "rgb(255,20,30)"), "\x1b[38;2;255;020;030mrgb(255,20,30)\x1b[0m"); + EXPECT_EQ(fmt::format(fg(fmt::rgb(255, 20, 30)), L"rgb(255,20,30) wide"), + L"\x1b[38;2;255;020;030mrgb(255,20,30) wide\x1b[0m"); EXPECT_EQ(fmt::format(fg(fmt::color::blue), "blue"), "\x1b[38;2;000;000;255mblue\x1b[0m"); EXPECT_EQ(