From 84dbc6898c256b00833682d437e5fe22a6f81d5e Mon Sep 17 00:00:00 2001 From: Nicolas Lesser Date: Thu, 6 Dec 2018 13:53:02 +0100 Subject: [PATCH] Fix a few bugs. --- include/fmt/color.h | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/include/fmt/color.h b/include/fmt/color.h index 2f9c0365..1218ccd0 100644 --- a/include/fmt/color.h +++ b/include/fmt/color.h @@ -331,6 +331,10 @@ FMT_CONSTEXPR_DECL text_format bg(rgb background) FMT_NOEXCEPT { return text_format(/*is_foreground=*/false, background); } +FMT_CONSTEXPR_DECL text_format operator|(emphasis lhs, emphasis rhs) FMT_NOEXCEPT { + return text_format(lhs) | rhs; +} + namespace internal { template @@ -348,9 +352,9 @@ struct ansi_color_escape { uint8_t em_codes[4] = {}; if ((uint32_t)em & (uint32_t)emphasis::bold) em_codes[0] = 1; - if ((uint32_t)em & (uint32_t)emphasis::underline) - em_codes[1] = 3; if ((uint32_t)em & (uint32_t)emphasis::italic) + em_codes[1] = 3; + if ((uint32_t)em & (uint32_t)emphasis::underline) em_codes[2] = 4; if ((uint32_t)em & (uint32_t)emphasis::strikethrough) em_codes[3] = 9;