diff options
Diffstat (limited to 'alacritty_terminal/src')
-rw-r--r-- | alacritty_terminal/src/ansi.rs | 23 | ||||
-rw-r--r-- | alacritty_terminal/src/config/mod.rs | 2 | ||||
-rw-r--r-- | alacritty_terminal/src/term/cell.rs | 9 | ||||
-rw-r--r-- | alacritty_terminal/src/term/mod.rs | 32 |
4 files changed, 65 insertions, 1 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs index 14617de1..eaaf5d62 100644 --- a/alacritty_terminal/src/ansi.rs +++ b/alacritty_terminal/src/ansi.rs @@ -790,6 +790,10 @@ pub enum Attr { Underline, /// Underlined twice. DoubleUnderline, + /// Undercurl twice. + Undercurl, + /// Underlined with dots. + DottedUnderline, /// Blink cursor slowly. BlinkSlow, /// Blink cursor fast. @@ -800,6 +804,8 @@ pub enum Attr { Hidden, /// Strikeout text. Strike, + /// Strikeout text. + Overline, /// Cancel bold. CancelBold, /// Cancel bold and dim. @@ -816,10 +822,14 @@ pub enum Attr { CancelHidden, /// Cancel strikeout. CancelStrike, + /// Cancel strikeout. + CancelOverline, /// Set indexed foreground color. Foreground(Color), /// Set indexed background color. Background(Color), + /// Set indexed special color (for underlines). + Special(Color), } /// Identifiers which can be assigned to a graphic character set. @@ -1002,6 +1012,7 @@ where .trim() .to_owned(); self.handler.set_title(Some(title)); + return; } unhandled(params); @@ -1356,6 +1367,8 @@ fn attrs_from_sgr_parameters(params: &mut ParamsIter<'_>) -> Vec<Option<Attr>> { [3] => Some(Attr::Italic), [4, 0] => Some(Attr::CancelUnderline), [4, 2] => Some(Attr::DoubleUnderline), + [4, 3] => Some(Attr::Undercurl), + [4, 4] => Some(Attr::DottedUnderline), [4, ..] => Some(Attr::Underline), [5] => Some(Attr::BlinkSlow), [6] => Some(Attr::BlinkFast), @@ -1410,6 +1423,16 @@ fn attrs_from_sgr_parameters(params: &mut ParamsIter<'_>) -> Vec<Option<Attr>> { parse_sgr_color(&mut iter).map(Attr::Background) }, [49] => Some(Attr::Background(Color::Named(NamedColor::Background))), + [53] => Some(Attr::Overline), + [55] => Some(Attr::CancelOverline), + [58, params @ ..] => { + let rgb_start = if params.len() > 4 { 2 } else { 1 }; + let rgb_iter = params[rgb_start..].iter().copied(); + let mut iter = iter::once(params[0]).chain(rgb_iter); + + parse_sgr_color(&mut iter).map(Attr::Special) + }, + [59] => Some(Attr::Special(Color::Named(NamedColor::Foreground))), [90] => Some(Attr::Foreground(Color::Named(NamedColor::BrightBlack))), [91] => Some(Attr::Foreground(Color::Named(NamedColor::BrightRed))), [92] => Some(Attr::Foreground(Color::Named(NamedColor::BrightGreen))), diff --git a/alacritty_terminal/src/config/mod.rs b/alacritty_terminal/src/config/mod.rs index 0b313598..382314bd 100644 --- a/alacritty_terminal/src/config/mod.rs +++ b/alacritty_terminal/src/config/mod.rs @@ -66,6 +66,7 @@ pub struct Cursor { pub style: ConfigCursorStyle, pub vi_mode_style: Option<ConfigCursorStyle>, pub unfocused_hollow: bool, + pub cursor_crosshairs: bool, thickness: Percentage, blink_interval: u64, @@ -79,6 +80,7 @@ impl Default for Cursor { blink_interval: 750, style: Default::default(), vi_mode_style: Default::default(), + cursor_crosshairs: false, } } } diff --git a/alacritty_terminal/src/term/cell.rs b/alacritty_terminal/src/term/cell.rs index 18aad87d..14229d15 100644 --- a/alacritty_terminal/src/term/cell.rs +++ b/alacritty_terminal/src/term/cell.rs @@ -26,6 +26,9 @@ bitflags! { const LEADING_WIDE_CHAR_SPACER = 0b0000_0100_0000_0000; const DOUBLE_UNDERLINE = 0b0000_1000_0000_0000; const GRAPHICS = 0b0001_0000_0000_0000; + const UNDERCURL = 0b0010_0000_0000_0000; + const DOTTED_UNDERLINE = 0b0100_0000_0000_0000; + const OVERLINE = 0b1000_0000_0000_0000; } } @@ -66,6 +69,7 @@ pub struct Cell { pub c: char, pub fg: Color, pub bg: Color, + pub sp: Color, pub flags: Flags, #[serde(default)] extra: Option<Box<CellExtra>>, @@ -78,6 +82,7 @@ impl Default for Cell { c: ' ', bg: Color::Named(NamedColor::Background), fg: Color::Named(NamedColor::Foreground), + sp: Color::Named(NamedColor::Foreground), flags: Flags::empty(), extra: None, } @@ -135,10 +140,14 @@ impl GridCell for Cell { (self.c == ' ' || self.c == '\t') && self.bg == Color::Named(NamedColor::Background) && self.fg == Color::Named(NamedColor::Foreground) + && self.sp == Color::Named(NamedColor::Foreground) && !self.flags.intersects( Flags::INVERSE | Flags::UNDERLINE | Flags::DOUBLE_UNDERLINE + | Flags::UNDERCURL + | Flags::DOTTED_UNDERLINE + | Flags::OVERLINE | Flags::STRIKEOUT | Flags::WRAPLINE | Flags::WIDE_CHAR_SPACER diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs index 90af5ce7..17f64099 100644 --- a/alacritty_terminal/src/term/mod.rs +++ b/alacritty_terminal/src/term/mod.rs @@ -802,6 +802,7 @@ impl<T> Term<T> { let c = self.grid.cursor.charsets[self.active_charset].map(c); let fg = self.grid.cursor.template.fg; let bg = self.grid.cursor.template.bg; + let sp = self.grid.cursor.template.sp; let flags = self.grid.cursor.template.flags; let mut cursor_cell = self.grid.cursor_cell(); @@ -831,6 +832,7 @@ impl<T> Term<T> { cursor_cell.c = c; cursor_cell.fg = fg; cursor_cell.bg = bg; + cursor_cell.sp = sp; cursor_cell.flags = flags; } } @@ -1513,9 +1515,11 @@ impl<T: EventListener> Handler for Term<T> { match attr { Attr::Foreground(color) => cursor.template.fg = color, Attr::Background(color) => cursor.template.bg = color, + Attr::Special(color) => cursor.template.sp = color, Attr::Reset => { cursor.template.fg = Color::Named(NamedColor::Foreground); cursor.template.bg = Color::Named(NamedColor::Background); + cursor.template.sp = Color::Named(NamedColor::Foreground); cursor.template.flags = Flags::empty(); }, Attr::Reverse => cursor.template.flags.insert(Flags::INVERSE), @@ -1528,14 +1532,40 @@ impl<T: EventListener> Handler for Term<T> { Attr::CancelItalic => cursor.template.flags.remove(Flags::ITALIC), Attr::Underline => { cursor.template.flags.remove(Flags::DOUBLE_UNDERLINE); + cursor.template.flags.remove(Flags::UNDERCURL); + cursor.template.flags.remove(Flags::DOTTED_UNDERLINE); cursor.template.flags.insert(Flags::UNDERLINE); }, Attr::DoubleUnderline => { cursor.template.flags.remove(Flags::UNDERLINE); + cursor.template.flags.remove(Flags::UNDERCURL); + cursor.template.flags.remove(Flags::DOTTED_UNDERLINE); cursor.template.flags.insert(Flags::DOUBLE_UNDERLINE); }, + Attr::Undercurl => { + cursor.template.flags.remove(Flags::UNDERLINE); + cursor.template.flags.remove(Flags::DOUBLE_UNDERLINE); + cursor.template.flags.remove(Flags::DOTTED_UNDERLINE); + cursor.template.flags.insert(Flags::UNDERCURL); + }, + Attr::DottedUnderline => { + cursor.template.flags.remove(Flags::UNDERLINE); + cursor.template.flags.remove(Flags::DOUBLE_UNDERLINE); + cursor.template.flags.remove(Flags::UNDERCURL); + cursor.template.flags.insert(Flags::DOTTED_UNDERLINE); + }, Attr::CancelUnderline => { - cursor.template.flags.remove(Flags::UNDERLINE | Flags::DOUBLE_UNDERLINE); + cursor.template.flags.remove( + Flags::UNDERLINE | + Flags::DOUBLE_UNDERLINE | + Flags::UNDERCURL | + Flags::DOTTED_UNDERLINE); + }, + Attr::Overline => { + cursor.template.flags.insert(Flags::OVERLINE); + }, + Attr::CancelOverline => { + cursor.template.flags.remove(Flags::OVERLINE); }, Attr::Hidden => cursor.template.flags.insert(Flags::HIDDEN), Attr::CancelHidden => cursor.template.flags.remove(Flags::HIDDEN), |