aboutsummaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/ansi.rs
diff options
context:
space:
mode:
authorChristian Duerr <contact@christianduerr.com>2020-08-12 16:05:22 +0000
committerGitHub <noreply@github.com>2020-08-12 19:05:22 +0300
commitb904207b1979bb86f86c2a7db1720ce04571508a (patch)
treee0961c9f8c087f11ceb81061ebd468972a3d4cda /alacritty_terminal/src/ansi.rs
parent96ea5c445ecc25a5b2d400b11f0ff843e9cbdd7a (diff)
downloadalacritty-b904207b1979bb86f86c2a7db1720ce04571508a.tar.gz
alacritty-b904207b1979bb86f86c2a7db1720ce04571508a.zip
Add support for double underlines
This adds support for double underlines using the colon separated escape sequence `CSI 4 : 2 m`. Alacritty will now also always fallback to the normal underline in case any of the other underlines like the undercurl are specified. The escape sequence `CSI 4 : 0 m` can now be used to clear all underlines. Some terminals support `CSI 21 m` for double underline, but since Alacritty already uses that as cancel bold which is a little more consistent, that behavior has not changed. So the colon separated variant must be used.
Diffstat (limited to 'alacritty_terminal/src/ansi.rs')
-rw-r--r--alacritty_terminal/src/ansi.rs8
1 files changed, 6 insertions, 2 deletions
diff --git a/alacritty_terminal/src/ansi.rs b/alacritty_terminal/src/ansi.rs
index dd2012de..8f1cf07f 100644
--- a/alacritty_terminal/src/ansi.rs
+++ b/alacritty_terminal/src/ansi.rs
@@ -618,6 +618,8 @@ pub enum Attr {
Italic,
/// Underline text.
Underline,
+ /// Underlined twice.
+ DoubleUnderline,
/// Blink cursor slowly.
BlinkSlow,
/// Blink cursor fast.
@@ -634,7 +636,7 @@ pub enum Attr {
CancelBoldDim,
/// Cancel italic.
CancelItalic,
- /// Cancel underline.
+ /// Cancel all underlines.
CancelUnderline,
/// Cancel blink.
CancelBlink,
@@ -1151,7 +1153,9 @@ fn attrs_from_sgr_parameters(params: &mut ParamsIter) -> Vec<Option<Attr>> {
[1] => Some(Attr::Bold),
[2] => Some(Attr::Dim),
[3] => Some(Attr::Italic),
- [4] => Some(Attr::Underline),
+ [4, 0] => Some(Attr::CancelUnderline),
+ [4, 2] => Some(Attr::DoubleUnderline),
+ [4, ..] => Some(Attr::Underline),
[5] => Some(Attr::BlinkSlow),
[6] => Some(Attr::BlinkFast),
[7] => Some(Attr::Reverse),