Skip to content

Commit

Permalink
tui: Port improvement from ratatui on crossterm 0.28 (ratatui/ratatui…
Browse files Browse the repository at this point in the history
  • Loading branch information
archseer authored and mxxntype committed Aug 14, 2024
1 parent d8e9fc8 commit 762eaa9
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions helix-tui/src/backend/crossterm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use crossterm::{
},
execute, queue,
style::{
Attribute as CAttribute, Color as CColor, Print, SetAttribute, SetBackgroundColor,
SetForegroundColor,
Attribute as CAttribute, Color as CColor, Colors, Print, SetAttribute, SetBackgroundColor,
SetColors, SetForegroundColor,
},
terminal::{self, Clear, ClearType},
Command,
Expand Down Expand Up @@ -260,14 +260,12 @@ where
diff.queue(&mut self.buffer)?;
modifier = cell.modifier;
}
if cell.fg != fg {
let color = CColor::from(cell.fg);
queue!(self.buffer, SetForegroundColor(color))?;
if cell.fg != fg || cell.bg != bg {
queue!(
self.buffer,
SetColors(Colors::new(cell.fg.into(), cell.bg.into()))
)?;
fg = cell.fg;
}
if cell.bg != bg {
let color = CColor::from(cell.bg);
queue!(self.buffer, SetBackgroundColor(color))?;
bg = cell.bg;
}

Expand Down

0 comments on commit 762eaa9

Please sign in to comment.