mirror of
https://github.com/ratatui/ratatui.git
synced 2025-09-27 13:01:13 +00:00
fix(crossterm): terminal should keep Bold when removing Dim (#1541)
The Dim removal should behave the same as the logic for Bold removal that sends NormalIntensity sequence and then restores Dim when needed. Signed-off-by: Martin Sivak <mars@montik.net>
This commit is contained in:
parent
17bba14540
commit
18e70d3d51
@ -405,11 +405,19 @@ impl ModifierDiff {
|
||||
if removed.contains(Modifier::REVERSED) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NoReverse))?;
|
||||
}
|
||||
if removed.contains(Modifier::BOLD) {
|
||||
if removed.contains(Modifier::BOLD) || removed.contains(Modifier::DIM) {
|
||||
// Bold and Dim are both reset by applying the Normal intensity
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NormalIntensity))?;
|
||||
|
||||
// The remaining Bold and Dim attributes must be
|
||||
// reapplied after the intensity reset above.
|
||||
if self.to.contains(Modifier::DIM) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::Dim))?;
|
||||
}
|
||||
|
||||
if self.to.contains(Modifier::BOLD) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::Bold))?;
|
||||
}
|
||||
}
|
||||
if removed.contains(Modifier::ITALIC) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NoItalic))?;
|
||||
@ -417,9 +425,6 @@ impl ModifierDiff {
|
||||
if removed.contains(Modifier::UNDERLINED) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NoUnderline))?;
|
||||
}
|
||||
if removed.contains(Modifier::DIM) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NormalIntensity))?;
|
||||
}
|
||||
if removed.contains(Modifier::CROSSED_OUT) {
|
||||
queue!(w, SetAttribute(CrosstermAttribute::NotCrossedOut))?;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user