1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-27 02:25:28 +03:00

term+termwiz: add Overline support

This commit teaches the terminal model about the overline attribute
and the SGR codes to enable/disable overline.

The render layer in the GUI doesn't yet understand this attribute.
This commit is contained in:
Wez Furlong 2020-06-20 22:48:36 -07:00
parent 4e6357b218
commit badc4f9d9c
3 changed files with 11 additions and 0 deletions

View File

@ -2386,6 +2386,9 @@ impl TerminalState {
Sgr::Underline(underline) => { Sgr::Underline(underline) => {
self.pen.set_underline(underline); self.pen.set_underline(underline);
} }
Sgr::Overline(overline) => {
self.pen.set_overline(overline);
}
Sgr::Blink(blink) => { Sgr::Blink(blink) => {
self.pen.set_blink(blink); self.pen.set_blink(blink);
} }

View File

@ -158,6 +158,7 @@ impl CellAttributes {
bitfield!(strikethrough, set_strikethrough, 8); bitfield!(strikethrough, set_strikethrough, 8);
bitfield!(invisible, set_invisible, 9); bitfield!(invisible, set_invisible, 9);
bitfield!(wrapped, set_wrapped, 10); bitfield!(wrapped, set_wrapped, 10);
bitfield!(overline, set_overline, 11);
/// Returns true if the attribute bits in both objects are equal. /// Returns true if the attribute bits in both objects are equal.
/// This can be used to cheaply test whether the styles of the two /// This can be used to cheaply test whether the styles of the two

View File

@ -1094,6 +1094,7 @@ pub enum Sgr {
Font(Font), Font(Font),
Foreground(ColorSpec), Foreground(ColorSpec),
Background(ColorSpec), Background(ColorSpec),
Overline(bool),
} }
impl Display for Sgr { impl Display for Sgr {
@ -1135,6 +1136,8 @@ impl Display for Sgr {
Sgr::Invisible(false) => code!(InvisibleOff), Sgr::Invisible(false) => code!(InvisibleOff),
Sgr::StrikeThrough(true) => code!(StrikeThroughOn), Sgr::StrikeThrough(true) => code!(StrikeThroughOn),
Sgr::StrikeThrough(false) => code!(StrikeThroughOff), Sgr::StrikeThrough(false) => code!(StrikeThroughOff),
Sgr::Overline(true) => code!(OverlineOn),
Sgr::Overline(false) => code!(OverlineOff),
Sgr::Font(Font::Default) => code!(DefaultFont), Sgr::Font(Font::Default) => code!(DefaultFont),
Sgr::Font(Font::Alternate(1)) => code!(AltFont1), Sgr::Font(Font::Alternate(1)) => code!(AltFont1),
Sgr::Font(Font::Alternate(2)) => code!(AltFont2), Sgr::Font(Font::Alternate(2)) => code!(AltFont2),
@ -1873,6 +1876,8 @@ impl<'a> CSIParser<'a> {
SgrCode::InvisibleOff => one!(Sgr::Invisible(false)), SgrCode::InvisibleOff => one!(Sgr::Invisible(false)),
SgrCode::StrikeThroughOn => one!(Sgr::StrikeThrough(true)), SgrCode::StrikeThroughOn => one!(Sgr::StrikeThrough(true)),
SgrCode::StrikeThroughOff => one!(Sgr::StrikeThrough(false)), SgrCode::StrikeThroughOff => one!(Sgr::StrikeThrough(false)),
SgrCode::OverlineOn => one!(Sgr::Overline(true)),
SgrCode::OverlineOff => one!(Sgr::Overline(false)),
SgrCode::DefaultFont => one!(Sgr::Font(Font::Default)), SgrCode::DefaultFont => one!(Sgr::Font(Font::Default)),
SgrCode::AltFont1 => one!(Sgr::Font(Font::Alternate(1))), SgrCode::AltFont1 => one!(Sgr::Font(Font::Alternate(1))),
SgrCode::AltFont2 => one!(Sgr::Font(Font::Alternate(2))), SgrCode::AltFont2 => one!(Sgr::Font(Font::Alternate(2))),
@ -1940,6 +1945,8 @@ pub enum SgrCode {
BackgroundCyan = 46, BackgroundCyan = 46,
BackgroundWhite = 47, BackgroundWhite = 47,
BackgroundDefault = 49, BackgroundDefault = 49,
OverlineOn = 53,
OverlineOff = 55,
ForegroundBrightBlack = 90, ForegroundBrightBlack = 90,
ForegroundBrightRed = 91, ForegroundBrightRed = 91,