aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.rs
diff options
context:
space:
mode:
authorKirill Chibisov <contact@kchibisov.com>2022-03-16 19:27:55 +0300
committerGitHub <noreply@github.com>2022-03-16 19:27:55 +0300
commitf4bdf5fb36fdf3b329be8253da39050abe7238a5 (patch)
tree9b49a78b15fdd73850a7bfc279e3986af2b59683 /alacritty_terminal/src/term/mod.rs
parent589c1e9c6b8830625162af14a9a7aee32c7aade0 (diff)
downloadalacritty-f4bdf5fb36fdf3b329be8253da39050abe7238a5.tar.gz
alacritty-f4bdf5fb36fdf3b329be8253da39050abe7238a5.zip
Add colored underline support
This commit adds support for colored underline and refines the dynamic extra storage. The extra storage now is using `Arc` making cloning it way faster compared to `Box` approach which scales really well when it comes to cloning in `Term::write_at_cursor`, since cloning `Arc` is constant time. Fixes #4142.
Diffstat (limited to 'alacritty_terminal/src/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 96f0d1e7..fa7d2b66 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -1047,6 +1047,7 @@ impl<T> Term<T> {
let fg = self.grid.cursor.template.fg;
let bg = self.grid.cursor.template.bg;
let flags = self.grid.cursor.template.flags;
+ let extra = self.grid.cursor.template.extra.clone();
let mut cursor_cell = self.grid.cursor_cell();
@@ -1070,12 +1071,11 @@ impl<T> Term<T> {
cursor_cell = self.grid.cursor_cell();
}
- cursor_cell.drop_extra();
-
cursor_cell.c = c;
cursor_cell.fg = fg;
cursor_cell.bg = bg;
cursor_cell.flags = flags;
+ cursor_cell.extra = extra;
}
#[inline]
@@ -1826,10 +1826,12 @@ impl<T: EventListener> Handler for Term<T> {
match attr {
Attr::Foreground(color) => cursor.template.fg = color,
Attr::Background(color) => cursor.template.bg = color,
+ Attr::UnderlineColor(color) => cursor.template.set_underline_color(color),
Attr::Reset => {
cursor.template.fg = Color::Named(NamedColor::Foreground);
cursor.template.bg = Color::Named(NamedColor::Background);
cursor.template.flags = Flags::empty();
+ cursor.template.set_underline_color(None);
},
Attr::Reverse => cursor.template.flags.insert(Flags::INVERSE),
Attr::CancelReverse => cursor.template.flags.remove(Flags::INVERSE),