mirror of
https://github.com/ArthurSonzogni/FTXUI.git
synced 2024-11-25 12:11:33 +08:00
Fixed dim and bold not mixing well (#460)
One single reset code controls both the dim and bold properties. Mixing both led to one of the properties being wrongly reset. Co-authored-by: Arthur Sonzogni <sonzogniarthur@gmail.com>
This commit is contained in:
parent
36460fea2a
commit
7cc68cfbd0
@ -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
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user