diff --git a/src/style/stylize.rs b/src/style/stylize.rs index fcb12da5c..87bf14700 100644 --- a/src/style/stylize.rs +++ b/src/style/stylize.rs @@ -105,6 +105,10 @@ pub trait Stylize: Sized { stylize_method!(reset Attribute::Reset); stylize_method!(bold Attribute::Bold); stylize_method!(underlined Attribute::Underlined); + stylize_method!(double_underlined Attribute::DoubleUnderlined); + stylize_method!(undercurled Attribute::Undercurled); + stylize_method!(underdotted Attribute::Underdotted); + stylize_method!(underdashed Attribute::Underdashed); stylize_method!(reverse Attribute::Reverse); stylize_method!(dim Attribute::Dim); stylize_method!(italic Attribute::Italic); diff --git a/src/style/types/attribute.rs b/src/style/types/attribute.rs index 8b7d52ca4..0b17b865c 100644 --- a/src/style/types/attribute.rs +++ b/src/style/types/attribute.rs @@ -101,16 +101,6 @@ Attribute! { /// Underlines the text. Underlined = 4, - // Other types of underlining - /// Double underlines the text. - DoubleUnderlined = 2, - /// Undercurls the text. - Undercurled = 3, - /// Underdots the text. - Underdotted = 4, - /// Underdashes the text. - Underdashed = 5, - /// Makes the text blinking (< 150 per minute). SlowBlink = 5, /// Makes the text blinking (>= 150 per minute). @@ -151,6 +141,16 @@ Attribute! { NotFramedOrEncircled = 54, /// Turns off the `OverLined` attribute. NotOverLined = 55, + // Other types of underlining + + /// Double underlines the text. + DoubleUnderlined = 2, + /// Undercurls the text. + Undercurled = 3, + /// Underdots the text. + Underdotted = 4, + /// Underdashes the text. + Underdashed = 5, } impl Display for Attribute { @@ -175,7 +175,7 @@ impl Attribute { /// /// See pub fn sgr(self) -> String { - if (self as usize) > 4 && (self as usize) < 9 { + if (self as usize) > 23 { return "4:".to_string() + SGR[self as usize].to_string().as_str(); } SGR[self as usize].to_string()