| 1 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::borrowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/::Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#; |
| 2 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/; |
| 3 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::hashrust-analyzer cargo std https://github.com/rust-lang/rust/library/std hash/::{Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash#, Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#}; |
| 4 |
|
| 5 |
use lazy_staticrust-analyzer cargo lazy_static 1.4.0 crate/::lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!; |
| 6 |
|
| 7 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::ansirust-analyzer cargo git-delta 0.19.2 ansi/; |
| 8 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::colorrust-analyzer cargo git-delta 0.19.2 color/; |
| 9 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::git_configrust-analyzer cargo git-delta 0.19.2 git_config/::GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#; |
| 10 |
|
| 11 |
// PERF: Avoid deriving Copy here? |
| 12 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 13 |
pub struct Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 14 |
pub ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#, |
| 15 |
pub is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph.: bool, |
| 16 |
pub is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted.: bool, |
| 17 |
pub is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.: bool, |
| 18 |
pub is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.: bool, |
| 19 |
pub decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#, |
| 20 |
} |
| 21 |
|
| 22 |
// More compact debug output, replace false/empty with lowercase and true with uppercase. |
| 23 |
impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 24 |
fn fmtrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 25 |
let ansi = if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_plainrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]is_plain().() { |
| 26 |
"<a".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 27 |
} else { |
| 28 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("ansi_term_style: {:?}, <", self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.) |
| 29 |
}; |
| 30 |
|
| 31 |
let deco = if self.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style. rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq().==rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq(). rust-analyzer cargo git-delta 0.19.2 style/impl#[DecorationStyle][`PartialEq<Self>`]eq().DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration# { |
| 32 |
"d>".intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/impl#[T][`Into<U>`]into().() |
| 33 |
} else { |
| 34 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!(">, decoration_style: {:?}", self.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.) |
| 35 |
}; |
| 36 |
|
| 37 |
let is_set = |c: char, set: bool| -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 38 |
if set { |
| 39 |
c.to_uppercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_uppercase().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 40 |
} else { |
| 41 |
c.to_lowercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_lowercase().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 42 |
} |
| 43 |
}; |
| 44 |
|
| 45 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 46 |
f, |
| 47 |
"Style {{ {}{}{}{}{}{} }}", |
| 48 |
ansi, |
| 49 |
is_set('e', self.is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph.), |
| 50 |
is_set('o', self.is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted.), |
| 51 |
is_set('r', self.is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.), |
| 52 |
is_set('s', self.is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.), |
| 53 |
deco |
| 54 |
) |
| 55 |
} |
| 56 |
} |
| 57 |
|
| 58 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:, Copyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Copy:, Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/macros/Debug:, PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq:, Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 59 |
pub enum DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle# { |
| 60 |
Boxrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Box#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 61 |
Underlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Underline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 62 |
Overlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Overline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 63 |
UnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#UnderOverline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 64 |
BoxWithUnderlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 65 |
BoxWithOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithOverline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 66 |
BoxWithUnderOverlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#BoxWithUnderOverline#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#), |
| 67 |
#[defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/default:] |
| 68 |
NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#, |
| 69 |
} |
| 70 |
|
| 71 |
impl Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 72 |
pub fn newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().() -> Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[Style] { |
| 73 |
Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[Style] { |
| 74 |
ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().(), |
| 75 |
is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph.: false, |
| 76 |
is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted.: false, |
| 77 |
is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw.: false, |
| 78 |
is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted.: false, |
| 79 |
decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style.: DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::NoDecorationrust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#NoDecoration#, |
| 80 |
} |
| 81 |
} |
| 82 |
|
| 83 |
pub fn from_colorsrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]from_colors().( |
| 84 |
foreground: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#>, |
| 85 |
background: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#>, |
| 86 |
) -> Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[Style] { |
| 87 |
Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[Style] { |
| 88 |
ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 89 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground., |
| 90 |
backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background., |
| 91 |
..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().() |
| 92 |
}, |
| 93 |
..Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().() |
| 94 |
} |
| 95 |
} |
| 96 |
|
| 97 |
pub fn paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().<'a, I, S: 'a + ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned# + ?Sizedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core marker/Sized#>( |
| 98 |
self, |
| 99 |
input: I, |
| •100 |
) -> ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#<'a, S> |
| 101 |
where |
| 102 |
I: Intorust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/Into#<Cowrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/Cow#<'a, S>>, |
| 103 |
<S as ToOwnedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#>::Ownedrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc borrow/ToOwned#Owned#: fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug#, |
| 104 |
{ |
| 105 |
self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..paintrust-analyzer cargo nu-ansi-term 0.50.3 display/impl#[Style]paint().(input) |
| 106 |
} |
| 107 |
|
| 108 |
pub fn get_background_colorrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]get_background_color().(&self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#> { |
| 109 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_reverserust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_reverse. { |
| 110 |
self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. |
| 111 |
} else { |
| 112 |
self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. |
| 113 |
} |
| 114 |
} |
| 115 |
|
| 116 |
pub fn is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(&self, s: &str) -> bool { |
| 117 |
match ansirust-analyzer cargo git-delta 0.19.2 ansi/::parse_first_stylerust-analyzer cargo git-delta 0.19.2 ansi/parse_first_style().(s) { |
| 118 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parsed_style) => ansi_term_style_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality().(parsed_style, self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.), |
| 119 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => false, |
| 120 |
} |
| 121 |
} |
| 122 |
|
| 123 |
#[cfg(test)] |
| 124 |
pub fn get_matching_substringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]get_matching_substring().<'a>(&self, s: &'a str) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&'a str> { |
| 125 |
for (parsed_style, parsed_str) in ansirust-analyzer cargo git-delta 0.19.2 ansi/::parse_style_sectionsrust-analyzer cargo git-delta 0.19.2 ansi/parse_style_sections().(s) { |
| 126 |
if ansi_term_style_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality().(parsed_style, self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.) { |
| 127 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(parsed_str); |
| 128 |
} |
| 129 |
} |
| 130 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 131 |
} |
| 132 |
|
| •133 |
pub fn to_painted_stringrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]to_painted_string().(self) -> ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#<'static, str> { |
| 134 |
self.paintrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]paint().(self.to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()) |
| 135 |
} |
| 136 |
} |
| 137 |
|
| 138 |
/// Interpret `color_string` as a color specifier and return it painted accordingly. |
| 139 |
pub fn paint_color_stringrust-analyzer cargo git-delta 0.19.2 style/paint_color_string().<'a>( |
| 140 |
color_string: &'a str, |
| 141 |
true_color: bool, |
| 142 |
git_config: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<&GitConfigrust-analyzer cargo git-delta 0.19.2 git_config/GitConfig#>, |
| •143 |
) -> ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#<'a, str> { |
| 144 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = colorrust-analyzer cargo git-delta 0.19.2 color/::parse_colorrust-analyzer cargo git-delta 0.19.2 color/parse_color().(color_string, true_color, git_config) { |
| 145 |
let style = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 146 |
backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color), |
| 147 |
..ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::defaultrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style][Default]default().() |
| 148 |
}; |
| 149 |
style.paintrust-analyzer cargo nu-ansi-term 0.50.3 display/impl#[Style]paint().(color_string) |
| 150 |
} else { |
| •151 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::AnsiGenericStringrust-analyzer cargo nu-ansi-term 0.50.3 display/AnsiGenericString#::fromrust-analyzer cargo nu-ansi-term 0.50.3 display/impl#[`AnsiGenericString<'a, S>`][`From<I>`]from().(color_string) |
| 152 |
} |
| 153 |
} |
| 154 |
|
| 155 |
impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Displayrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Display# for Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 156 |
fn fmtrust-analyzer cargo git-delta 0.19.2 style/impl#[Style][Display]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 157 |
if self.is_rawrust-analyzer cargo git-delta 0.19.2 style/Style#is_raw. { |
| 158 |
return writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "raw"); |
| 159 |
} |
| 160 |
let mut words = Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#::<Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String#>::newrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T>`]new().(); |
| 161 |
if self.is_omittedrust-analyzer cargo git-delta 0.19.2 style/Style#is_omitted. { |
| 162 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("omit".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 163 |
} |
| 164 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink. { |
| 165 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("blink".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 166 |
} |
| 167 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold. { |
| 168 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("bold".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 169 |
} |
| 170 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_dimmedrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_dimmed. { |
| 171 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("dim".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 172 |
} |
| 173 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic. { |
| 174 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("italic".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 175 |
} |
| 176 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_reverserust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_reverse. { |
| 177 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("reverse".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 178 |
} |
| 179 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_strikethroughrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_strikethrough. { |
| 180 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("strike".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 181 |
} |
| 182 |
if self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..is_underlinerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_underline. { |
| 183 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("ul".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()); |
| 184 |
} |
| 185 |
|
| 186 |
match (self.is_syntax_highlightedrust-analyzer cargo git-delta 0.19.2 style/Style#is_syntax_highlighted., self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.) { |
| 187 |
(true, _) => words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("syntax".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 188 |
(false, Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color)) => { |
| 189 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(colorrust-analyzer cargo git-delta 0.19.2 color/::color_to_stringrust-analyzer cargo git-delta 0.19.2 color/color_to_string().(color)); |
| 190 |
} |
| 191 |
(false, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().("normal".to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().()), |
| 192 |
} |
| 193 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = self.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style..backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background. { |
| 194 |
words.pushrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/impl#[`Vec<T, A>`]push().(colorrust-analyzer cargo git-delta 0.19.2 color/::color_to_stringrust-analyzer cargo git-delta 0.19.2 color/color_to_string().(color)) |
| 195 |
} |
| 196 |
let style_str = words.joinrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc slice/impl#[`[T]`]join().(" "); |
| 197 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!(f, "{style_str}") |
| 198 |
} |
| 199 |
} |
| 200 |
|
| 201 |
pub fn ansi_term_style_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality().(a: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#, b: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#) -> bool { |
| 202 |
let a_attrs = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 203 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 204 |
backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 205 |
..a |
| 206 |
}; |
| 207 |
let b_attrs = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 208 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 209 |
backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 210 |
..b |
| 211 |
}; |
| 212 |
if a_attrs rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq#ne().b_attrs { |
| 213 |
false |
| 214 |
} else { |
| 215 |
ansi_term_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality().(a.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground., b.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.) |
| 216 |
&rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitAnd<Self>`]bitand(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][`BitAnd<Self>`]bitand().ansi_term_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality().(a.backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background., b.backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background.) |
| 217 |
} |
| 218 |
} |
| 219 |
|
| 220 |
// TODO: The equality methods were implemented first, and the equality_key |
| 221 |
// methods later. The former should be re-implemented in terms of the latter. |
| •222 |
// But why did the former not address equality of ansi_term::Color::Rgb values? |
| 223 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Clonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core clone/Clone:)] |
| 224 |
pub struct AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 225 |
attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key.: (bool, bool, bool, bool, bool, bool, bool, bool), |
| 226 |
foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u8, u8, u8, u8)>, |
| 227 |
background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<(u8, u8, u8, u8)>, |
| 228 |
} |
| 229 |
|
| 230 |
impl PartialEqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/PartialEq# for AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 231 |
fn eqrust-analyzer cargo git-delta 0.19.2 style/impl#[AnsiTermStyleEqualityKey][`PartialEq<Self>`]eq().(&self, other: &Selfrust-analyzer cargo git-delta 0.19.2 style/impl#[AnsiTermStyleEqualityKey][`PartialEq<Self>`]) -> bool { |
| 232 |
let option_eq = |opt_a, opt_b| match (opt_a, opt_b) { |
| 233 |
(Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(a), Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b)) => a rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(W, V, U, T)`][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(W, V, U, T)`][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(W, V, U, T)`][`PartialEq<Self>`]eq().b, |
| 234 |
(Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#) => true, |
| 235 |
_ => false, |
| 236 |
}; |
| 237 |
|
| 238 |
if self.attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(A, Z, Y, X, W, V, U, T)`][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(A, Z, Y, X, W, V, U, T)`][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core tuple/impl#[`(A, Z, Y, X, W, V, U, T)`][`PartialEq<Self>`]ne().other.attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key. { |
| 239 |
false |
| 240 |
} else { |
| 241 |
option_eq(self.foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key., other.foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key.) |
| 242 |
&& option_eq(self.background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key., other.background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key.) |
| 243 |
} |
| 244 |
} |
| 245 |
} |
| 246 |
|
| 247 |
impl Eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/Eq# for AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# {} |
| 248 |
|
| 249 |
impl Hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hash# for AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 250 |
fn hashrust-analyzer cargo git-delta 0.19.2 style/impl#[AnsiTermStyleEqualityKey][Hash]hash().<H: Hasherrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/Hasher#>(&self, state: &mut H) { |
| 251 |
self.attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key..hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core hash/impls/impl#[`(T, B, C, D, E, F, G, H)`][Hash]hash().(state); |
| 252 |
self.foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key..hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Hash]hash().(state); |
| 253 |
self.background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key..hashrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Hash]hash().(state); |
| 254 |
} |
| 255 |
} |
| 256 |
|
| 257 |
pub fn ansi_term_style_equality_keyrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality_key().(style: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#) -> AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 258 |
let attrs_key = ( |
| 259 |
style.is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold., |
| 260 |
style.is_dimmedrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_dimmed., |
| 261 |
style.is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic., |
| 262 |
style.is_underlinerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_underline., |
| 263 |
style.is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink., |
| 264 |
style.is_reverserust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_reverse., |
| 265 |
style.is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden., |
| 266 |
style.is_strikethroughrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_strikethrough., |
| 267 |
); |
| 268 |
AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 269 |
attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key., |
| 270 |
foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key.: style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ansi_term_color_equality_keyrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality_key().), |
| 271 |
background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key.: style.backgroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#background..maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]map().(ansi_term_color_equality_keyrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality_key().), |
| 272 |
} |
| 273 |
} |
| 274 |
|
| 275 |
impl fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Debugrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Debug# for AnsiTermStyleEqualityKeyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey# { |
| 276 |
fn fmtrust-analyzer cargo git-delta 0.19.2 style/impl#[AnsiTermStyleEqualityKey][Debug]fmt().(&self, f: &mut fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Formatterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Formatter#) -> fmtrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc fmt/::Resultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core fmt/Result# { |
| 277 |
let is_set = |c: char, set: bool| -> Stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/String# { |
| 278 |
if set { |
| 279 |
c.to_uppercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_uppercase().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 280 |
} else { |
| 281 |
c.to_lowercaserust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]to_lowercase().().to_stringrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc string/impl#[T][ToString]to_string().() |
| 282 |
} |
| 283 |
}; |
| 284 |
|
| 285 |
let (bold, dimmed, italic, underline, blink, reverse, hidden, strikethrough) = |
| 286 |
self.attrs_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#attrs_key.; |
| 287 |
writerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/write!!( |
| 288 |
f, |
| 289 |
"ansi_term::Style {{ {:?} {:?} {}{}{}{}{}{}{}{} }}", |
| 290 |
self.foreground_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#foreground_key., |
| 291 |
self.background_keyrust-analyzer cargo git-delta 0.19.2 style/AnsiTermStyleEqualityKey#background_key., |
| 292 |
is_set('b', bold), |
| 293 |
is_set('d', dimmed), |
| 294 |
is_set('i', italic), |
| 295 |
is_set('u', underline), |
| 296 |
is_set('l', blink), |
| 297 |
is_set('r', reverse), |
| 298 |
is_set('h', hidden), |
| 299 |
is_set('s', strikethrough), |
| 300 |
) |
| 301 |
} |
| 302 |
} |
| 303 |
|
| 304 |
fn ansi_term_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality().(a: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#>, b: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#>) -> bool { |
| 305 |
match a.ziprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]zip().(b) { |
| 306 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#((a, b)) => { |
| 307 |
a rust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Color][`PartialEq<Self>`]eq().==rust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Color][`PartialEq<Self>`]eq(). rust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Color][`PartialEq<Self>`]eq().b || ansi_term_16_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_16_color_equality().(a, b) || ansi_term_16_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_16_color_equality().(b, a) |
| 308 |
} |
| 309 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => a.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() && b.is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().(), |
| 310 |
} |
| 311 |
} |
| 312 |
|
| 313 |
fn ansi_term_16_color_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_16_color_equality().(a: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#, b: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#) -> bool { |
| 314 |
matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 315 |
(a, b), |
| 316 |
(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(0), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Blackrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Black#) |
| 317 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(1), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#) |
| 318 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(2), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#) |
| 319 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(3), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Yellowrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Yellow#) |
| 320 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(4), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Bluerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Blue#) |
| 321 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(5), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Purplerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Purple#) |
| 322 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(6), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Cyanrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Cyan#) |
| 323 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(7), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White#) |
| •324 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(8), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::DarkGrayrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#DarkGray#) |
| 325 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(9), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightRedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightRed#) |
| 326 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(10), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightGreenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightGreen#) |
| 327 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(11), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightYellowrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightYellow#) |
| 328 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(12), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightBluerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightBlue#) |
| 329 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(13), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightPurplerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightPurple#) |
| 330 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(14), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightCyanrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightCyan#) |
| 331 |
| (ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(15), ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightGrayrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightGray#) |
| 332 |
) |
| 333 |
} |
| 334 |
|
| 335 |
fn ansi_term_color_equality_keyrust-analyzer cargo git-delta 0.19.2 style/ansi_term_color_equality_key().(color: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#) -> (u8, u8, u8, u8) { |
| 336 |
// Same (r, g, b, a) encoding as in utils::bat::terminal::to_ansi_color. |
| 337 |
// When a = 0xFF, then a 256-color number is stored in the red channel, and |
| 338 |
// the green and blue channels are meaningless. But a=0 signifies an RGB |
| 339 |
// color. |
| 340 |
let default = 0xFF; |
| 341 |
match color { |
| 342 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(0) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Blackrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Black# => (0, default, default, default), |
| 343 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(1) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red# => (1, default, default, default), |
| 344 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(2) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green# => (2, default, default, default), |
| 345 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(3) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Yellowrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Yellow# => (3, default, default, default), |
| 346 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(4) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Bluerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Blue# => (4, default, default, default), |
| •347 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(5) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Purplerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Purple# | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Magentarust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Magenta# => { |
| 348 |
(5, default, default, default) |
| 349 |
} |
| 350 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(6) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Cyanrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Cyan# => (6, default, default, default), |
| 351 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(7) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Whiterust-analyzer cargo nu-ansi-term 0.50.3 style/Color#White# => (7, default, default, default), |
| •352 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(8) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::DarkGrayrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#DarkGray# => (8, default, default, default), |
| 353 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(9) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightRedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightRed# => (9, default, default, default), |
| 354 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(10) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightGreenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightGreen# => { |
| 355 |
(10, default, default, default) |
| 356 |
} |
| 357 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(11) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightYellowrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightYellow# => { |
| 358 |
(11, default, default, default) |
| 359 |
} |
| 360 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(12) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightBluerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightBlue# => { |
| 361 |
(12, default, default, default) |
| 362 |
} |
| 363 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(13) |
| 364 |
| ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightPurplerust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightPurple# |
| 365 |
| ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightMagentarust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightMagenta# => (13, default, default, default), |
| 366 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(14) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightCyanrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightCyan# => { |
| 367 |
(14, default, default, default) |
| 368 |
} |
| 369 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(15) | ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::LightGrayrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#LightGray# => { |
| 370 |
(15, default, default, default) |
| 371 |
} |
| 372 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Fixedrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Fixed#(n) => (n, default, default, default), |
| •373 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Rgbrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Rgb#(r, g, b) => (r, g, b, 0), |
| 374 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Defaultrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Default# => todorust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/todo!!(), |
| 375 |
} |
| 376 |
} |
| 377 |
|
| 378 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 379 |
pub static ref GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE#: Stylerust-analyzer cargo git-delta 0.19.2 style/Style# = Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 380 |
ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Redrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Red#.normalrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Color]normal().(), |
| 381 |
..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().() |
| 382 |
}; |
| 383 |
pub static ref GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE#: Stylerust-analyzer cargo git-delta 0.19.2 style/Style# = Stylerust-analyzer cargo git-delta 0.19.2 style/Style# { |
| 384 |
ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.: ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Colorrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#::Greenrust-analyzer cargo nu-ansi-term 0.50.3 style/Color#Green#.normalrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Color]normal().(), |
| 385 |
..Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().() |
| 386 |
}; |
| 387 |
} |
| 388 |
|
| 389 |
pub fn line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().(line: &str, styles: &[Stylerust-analyzer cargo git-delta 0.19.2 style/Style#]) -> bool { |
| 390 |
if !rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().ansirust-analyzer cargo git-delta 0.19.2 ansi/::string_starts_with_ansi_style_sequencerust-analyzer cargo git-delta 0.19.2 ansi/string_starts_with_ansi_style_sequence().(line) { |
| 391 |
return false; |
| 392 |
} |
| 393 |
for style in styles { |
| 394 |
if style.is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(line) { |
| 395 |
return false; |
| 396 |
} |
| 397 |
} |
| 398 |
true |
| 399 |
} |
| 400 |
|
| 401 |
#[cfg(test)] |
| 402 |
pub mod testsrust-analyzer cargo git-delta 0.19.2 style/tests/ { |
| 403 |
|
| 404 |
use superrust-analyzer cargo git-delta 0.19.2 style/::*; |
| 405 |
|
| 406 |
// To add to these tests: |
| 407 |
// 1. Stage a file with a single line containing the string "text" |
| 408 |
// 2. git -c 'color.diff.new = $STYLE_STRING' diff --cached --color=always | cat -A |
| 409 |
|
| 410 |
lazy_staticrust-analyzer cargo lazy_static 1.4.0 lazy_static!! { |
| 411 |
pub static ref GIT_STYLE_STRING_EXAMPLESrust-analyzer cargo git-delta 0.19.2 style/tests/GIT_STYLE_STRING_EXAMPLES#: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<(&'static str, &'static str)> = vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 412 |
// <git-default> "\x1b[32m+\x1b[m\x1b[32mtext\x1b[m\n" |
| 413 |
("0", "\x1b[30m+\x1b[m\x1b[30mtext\x1b[m\n"), |
| 414 |
("black", "\x1b[30m+\x1b[m\x1b[30mtext\x1b[m\n"), |
| 415 |
("1", "\x1b[31m+\x1b[m\x1b[31mtext\x1b[m\n"), |
| 416 |
("red", "\x1b[31m+\x1b[m\x1b[31mtext\x1b[m\n"), |
| 417 |
("0 1", "\x1b[30;41m+\x1b[m\x1b[30;41mtext\x1b[m\n"), |
| 418 |
("black red", "\x1b[30;41m+\x1b[m\x1b[30;41mtext\x1b[m\n"), |
| 419 |
("19", "\x1b[38;5;19m+\x1b[m\x1b[38;5;19mtext\x1b[m\n"), |
| 420 |
("black 19", "\x1b[30;48;5;19m+\x1b[m\x1b[30;48;5;19mtext\x1b[m\n"), |
| 421 |
("19 black", "\x1b[38;5;19;40m+\x1b[m\x1b[38;5;19;40mtext\x1b[m\n"), |
| 422 |
("19 20", "\x1b[38;5;19;48;5;20m+\x1b[m\x1b[38;5;19;48;5;20mtext\x1b[m\n"), |
| 423 |
("#aabbcc", "\x1b[38;2;170;187;204m+\x1b[m\x1b[38;2;170;187;204mtext\x1b[m\n"), |
| 424 |
("0 #aabbcc", "\x1b[30;48;2;170;187;204m+\x1b[m\x1b[30;48;2;170;187;204mtext\x1b[m\n"), |
| 425 |
("#aabbcc 0", "\x1b[38;2;170;187;204;40m+\x1b[m\x1b[38;2;170;187;204;40mtext\x1b[m\n"), |
| 426 |
("19 #aabbcc", "\x1b[38;5;19;48;2;170;187;204m+\x1b[m\x1b[38;5;19;48;2;170;187;204mtext\x1b[m\n"), |
| 427 |
("#aabbcc 19", "\x1b[38;2;170;187;204;48;5;19m+\x1b[m\x1b[38;2;170;187;204;48;5;19mtext\x1b[m\n"), |
| 428 |
("#aabbcc #ddeeff" , "\x1b[38;2;170;187;204;48;2;221;238;255m+\x1b[m\x1b[38;2;170;187;204;48;2;221;238;255mtext\x1b[m\n"), |
| 429 |
("bold #aabbcc #ddeeff" , "\x1b[1;38;2;170;187;204;48;2;221;238;255m+\x1b[m\x1b[1;38;2;170;187;204;48;2;221;238;255mtext\x1b[m\n"), |
| 430 |
("bold #aabbcc ul #ddeeff" , "\x1b[1;4;38;2;170;187;204;48;2;221;238;255m+\x1b[m\x1b[1;4;38;2;170;187;204;48;2;221;238;255mtext\x1b[m\n"), |
| 431 |
("bold #aabbcc ul #ddeeff strike" , "\x1b[1;4;9;38;2;170;187;204;48;2;221;238;255m+\x1b[m\x1b[1;4;9;38;2;170;187;204;48;2;221;238;255mtext\x1b[m\n"), |
| 432 |
("bold 0 ul 1 strike", "\x1b[1;4;9;30;41m+\x1b[m\x1b[1;4;9;30;41mtext\x1b[m\n"), |
| 433 |
("bold 0 ul 19 strike", "\x1b[1;4;9;30;48;5;19m+\x1b[m\x1b[1;4;9;30;48;5;19mtext\x1b[m\n"), |
| 434 |
("bold 19 ul 0 strike", "\x1b[1;4;9;38;5;19;40m+\x1b[m\x1b[1;4;9;38;5;19;40mtext\x1b[m\n"), |
| 435 |
("bold #aabbcc ul 0 strike", "\x1b[1;4;9;38;2;170;187;204;40m+\x1b[m\x1b[1;4;9;38;2;170;187;204;40mtext\x1b[m\n"), |
| 436 |
("bold #aabbcc ul 19 strike" , "\x1b[1;4;9;38;2;170;187;204;48;5;19m+\x1b[m\x1b[1;4;9;38;2;170;187;204;48;5;19mtext\x1b[m\n"), |
| 437 |
("bold 19 ul #aabbcc strike" , "\x1b[1;4;9;38;5;19;48;2;170;187;204m+\x1b[m\x1b[1;4;9;38;5;19;48;2;170;187;204mtext\x1b[m\n"), |
| 438 |
("bold 0 ul #aabbcc strike", "\x1b[1;4;9;30;48;2;170;187;204m+\x1b[m\x1b[1;4;9;30;48;2;170;187;204mtext\x1b[m\n"), |
| 439 |
(r##"black "#ddeeff""##, "\x1b[30;48;2;221;238;255m+\x1b[m\x1b[30;48;2;221;238;255mtext\x1b[m\n"), |
| 440 |
("brightred", "\x1b[91m+\x1b[m\x1b[91mtext\x1b[m\n"), |
| 441 |
("normal", "\x1b[mtext\x1b[m\n"), |
| 442 |
("blink", "\x1b[5m+\x1b[m\x1b[5mtext\x1b[m\n"), |
| 443 |
]; |
| 444 |
} |
| 445 |
|
| 446 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 447 |
fn test_parse_git_style_string_and_ansi_code_iteratorrust-analyzer cargo git-delta 0.19.2 style/tests/test_parse_git_style_string_and_ansi_code_iterator().() { |
| 448 |
for (git_style_string, git_output) in &*rust-analyzer cargo git-delta 0.19.2 style/tests/impl#[GIT_STYLE_STRING_EXAMPLES][Deref]deref().GIT_STYLE_STRING_EXAMPLESrust-analyzer cargo git-delta 0.19.2 style/tests/GIT_STYLE_STRING_EXAMPLES. { |
| 449 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(git_style_string).is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(git_output)); |
| 450 |
} |
| 451 |
} |
| 452 |
|
| 453 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 454 |
fn test_is_applied_to_negative_assertionrust-analyzer cargo git-delta 0.19.2 style/tests/test_is_applied_to_negative_assertion().() { |
| 455 |
let style_string_from_24 = "bold #aabbcc ul 19 strike"; |
| 456 |
let git_output_from_25 = "\x1b[1;4;9;38;5;19;48;2;170;187;204m+\x1b[m\x1b[1;4;9;38;5;19;48;2;170;187;204mtext\x1b[m\n"; |
| 457 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::from_git_strrust-analyzer cargo git-delta 0.19.2 parse_style/impl#[Style]from_git_str().(style_string_from_24).is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(git_output_from_25)); |
| 458 |
} |
| 459 |
|
| 460 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 461 |
fn test_git_default_stylesrust-analyzer cargo git-delta 0.19.2 style/tests/test_git_default_styles().() { |
| 462 |
let minus_line_from_unconfigured_git = "\x1b[31m-____\x1b[m\n"; |
| 463 |
let plus_line_from_unconfigured_git = "\x1b[32m+\x1b[m\x1b[32m____\x1b[m\n"; |
| 464 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE..is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(minus_line_from_unconfigured_git)); |
| 465 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE..is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(plus_line_from_unconfigured_git)); |
| 466 |
|
| 467 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE..is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(plus_line_from_unconfigured_git)); |
| 468 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE..is_applied_torust-analyzer cargo git-delta 0.19.2 style/impl#[Style]is_applied_to().(minus_line_from_unconfigured_git)); |
| 469 |
} |
| 470 |
|
| 471 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 472 |
fn test_line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/tests/test_line_has_style_other_than().() { |
| 473 |
let minus_line_from_unconfigured_git = "\x1b[31m-____\x1b[m\n"; |
| 474 |
let plus_line_from_unconfigured_git = "\x1b[32m+\x1b[m\x1b[32m____\x1b[m\n"; |
| 475 |
|
| 476 |
// Unstyled lines should test negative, regardless of supplied styles. |
| 477 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().("", &[])); |
| 478 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().("", &[*rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_MINUS_STYLE][Deref]deref().GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE.])); |
| 479 |
|
| 480 |
// Lines from git should test negative when corresponding default is supplied |
| 481 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 482 |
minus_line_from_unconfigured_git, |
| 483 |
&[*rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_MINUS_STYLE][Deref]deref().GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE.] |
| 484 |
)); |
| 485 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(!rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[bool][Not]not().line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 486 |
plus_line_from_unconfigured_git, |
| 487 |
&[*rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_PLUS_STYLE][Deref]deref().GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE.] |
| 488 |
)); |
| 489 |
|
| 490 |
// Styled lines should test positive when unless their style is supplied. |
| 491 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 492 |
minus_line_from_unconfigured_git, |
| 493 |
&[*rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_PLUS_STYLE][Deref]deref().GIT_DEFAULT_PLUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_PLUS_STYLE.] |
| 494 |
)); |
| 495 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 496 |
minus_line_from_unconfigured_git, |
| 497 |
&[] |
| 498 |
)); |
| 499 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 500 |
plus_line_from_unconfigured_git, |
| 501 |
&[*rust-analyzer cargo git-delta 0.19.2 style/impl#[GIT_DEFAULT_MINUS_STYLE][Deref]deref().GIT_DEFAULT_MINUS_STYLErust-analyzer cargo git-delta 0.19.2 style/GIT_DEFAULT_MINUS_STYLE.] |
| 502 |
)); |
| 503 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(line_has_style_other_thanrust-analyzer cargo git-delta 0.19.2 style/line_has_style_other_than().( |
| 504 |
plus_line_from_unconfigured_git, |
| 505 |
&[] |
| 506 |
)); |
| 507 |
} |
| 508 |
|
| 509 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 510 |
fn test_style_compact_debug_fmtrust-analyzer cargo git-delta 0.19.2 style/tests/test_style_compact_debug_fmt().() { |
| 511 |
let mut s = Stylerust-analyzer cargo git-delta 0.19.2 style/Style#::newrust-analyzer cargo git-delta 0.19.2 style/impl#[Style]new().(); |
| 512 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{s:?}"), "Style { <aeorsd> }"); |
| 513 |
s.is_emphrust-analyzer cargo git-delta 0.19.2 style/Style#is_emph. = true; |
| 514 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{s:?}"), "Style { <aEorsd> }"); |
| 515 |
s.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style. = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::newrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]new().().boldrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style]bold().(); |
| 516 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 517 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{s:?}"), |
| 518 |
"Style { ansi_term_style: Style { bold }, <Eorsd> }" |
| 519 |
); |
| 520 |
s.decoration_stylerust-analyzer cargo git-delta 0.19.2 style/Style#decoration_style. = DecorationStylerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#::Underlinerust-analyzer cargo git-delta 0.19.2 style/DecorationStyle#Underline#(s.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style.); |
| 521 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 522 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{s:?}"), |
| 523 |
"Style { ansi_term_style: Style { bold }, <Eors>, \ |
| 524 |
decoration_style: Underline(Style { bold }) }" |
| 525 |
); |
| 526 |
s.ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style. = ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#::defaultrust-analyzer cargo nu-ansi-term 0.50.3 style/impl#[Style][Default]default().(); |
| 527 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 528 |
formatrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/format!!("{s:?}"), |
| 529 |
"Style { <aEors>, decoration_style: Underline(Style { bold }) }" |
| 530 |
); |
| 531 |
} |
| 532 |
} |