summaryrefslogtreecommitdiff
path: root/alacritty_terminal/src/term/mod.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/term/mod.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/term/mod.rs')
-rw-r--r--alacritty_terminal/src/term/mod.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/alacritty_terminal/src/term/mod.rs b/alacritty_terminal/src/term/mod.rs
index 7a409e2e..993e6918 100644
--- a/alacritty_terminal/src/term/mod.rs
+++ b/alacritty_terminal/src/term/mod.rs
@@ -311,7 +311,7 @@ impl RenderableCell {
fn is_empty(&self) -> bool {
self.bg_alpha == 0.
- && !self.flags.intersects(Flags::UNDERLINE | Flags::STRIKEOUT)
+ && !self.flags.intersects(Flags::UNDERLINE | Flags::STRIKEOUT | Flags::DOUBLE_UNDERLINE)
&& self.inner == RenderableCellContent::Chars([' '; cell::MAX_ZEROWIDTH_CHARS + 1])
}
@@ -2017,8 +2017,17 @@ impl<T: EventListener> Handler for Term<T> {
Attr::CancelBoldDim => cursor.template.flags.remove(Flags::BOLD | Flags::DIM),
Attr::Italic => cursor.template.flags.insert(Flags::ITALIC),
Attr::CancelItalic => cursor.template.flags.remove(Flags::ITALIC),
- Attr::Underline => cursor.template.flags.insert(Flags::UNDERLINE),
- Attr::CancelUnderline => cursor.template.flags.remove(Flags::UNDERLINE),
+ Attr::Underline => {
+ cursor.template.flags.remove(Flags::DOUBLE_UNDERLINE);
+ cursor.template.flags.insert(Flags::UNDERLINE);
+ },
+ Attr::DoubleUnderline => {
+ cursor.template.flags.remove(Flags::UNDERLINE);
+ cursor.template.flags.insert(Flags::DOUBLE_UNDERLINE);
+ },
+ Attr::CancelUnderline => {
+ cursor.template.flags.remove(Flags::UNDERLINE | Flags::DOUBLE_UNDERLINE);
+ },
Attr::Hidden => cursor.template.flags.insert(Flags::HIDDEN),
Attr::CancelHidden => cursor.template.flags.remove(Flags::HIDDEN),
Attr::Strike => cursor.template.flags.insert(Flags::STRIKEOUT),