aboutsummaryrefslogtreecommitdiff
path: root/helix-tui/src/backend/crossterm.rs
diff options
context:
space:
mode:
authorA-Walrus2022-08-11 11:10:29 +0000
committerPascal Kuthe2022-10-01 15:00:34 +0000
commit3ad7d543ca17963f0839b1a6cd8abacdb5c60cf7 (patch)
tree8b754434eb9d3d21732c92bab64228efe2d283f4 /helix-tui/src/backend/crossterm.rs
parent999b45b28c157418c20a9a8cd9219db6ce0beac7 (diff)
Add separate color for underlines
Diffstat (limited to 'helix-tui/src/backend/crossterm.rs')
-rw-r--r--helix-tui/src/backend/crossterm.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/helix-tui/src/backend/crossterm.rs b/helix-tui/src/backend/crossterm.rs
index 252036f3..fe9da919 100644
--- a/helix-tui/src/backend/crossterm.rs
+++ b/helix-tui/src/backend/crossterm.rs
@@ -4,7 +4,7 @@ use crossterm::{
execute, queue,
style::{
Attribute as CAttribute, Color as CColor, Print, SetAttribute, SetBackgroundColor,
- SetForegroundColor,
+ SetForegroundColor, SetUnderlineColor,
},
terminal::{self, Clear, ClearType},
};
@@ -47,6 +47,7 @@ where
{
let mut fg = Color::Reset;
let mut bg = Color::Reset;
+ let mut underline = Color::Reset;
let mut modifier = Modifier::empty();
let mut last_pos: Option<(u16, u16)> = None;
for (x, y, cell) in content {
@@ -73,6 +74,11 @@ where
map_error(queue!(self.buffer, SetBackgroundColor(color)))?;
bg = cell.bg;
}
+ if cell.underline != underline {
+ let color = CColor::from(cell.underline);
+ map_error(queue!(self.buffer, SetUnderlineColor(color)))?;
+ underline = cell.underline;
+ }
map_error(queue!(self.buffer, Print(&cell.symbol)))?;
}