diff --git a/src/ftxui/screen/screen.cpp b/src/ftxui/screen/screen.cpp index 130d88f..61be597 100644 --- a/src/ftxui/screen/screen.cpp +++ b/src/ftxui/screen/screen.cpp @@ -55,23 +55,25 @@ void UpdatePixelStyle(std::stringstream& ss, if (next == previous) { return; } + + if ((!next.bold && previous.bold) || // + (!next.dim && previous.dim)) { + ss << "\x1B[22m"; // BOLD_RESET and DIM_RESET + // We might have wrongfully reset dim or bold because they share the same + // resetter. Take it into account so that the side effect will cause it to + // be set again below. + previous.bold = false; + previous.dim = false; + } if (next.bold && !previous.bold) { ss << "\x1B[1m"; // BOLD_SET } - if (!next.bold && previous.bold) { - ss << "\x1B[22m"; // BOLD_RESET - } - if (next.dim && !previous.dim) { ss << "\x1B[2m"; // DIM_SET } - if (!next.dim && previous.dim) { - ss << "\x1B[22m"; // DIM_RESET - } - if (next.underlined && !previous.underlined) { ss << "\x1B[4m"; // UNDERLINED_SET }