| 1 |
use anstyle_parserust-analyzer cargo anstyle-parse 0.2.3 crate/::{Paramsrust-analyzer cargo anstyle-parse 0.2.3 params/Params#, ParamsIterrust-analyzer cargo anstyle-parse 0.2.3 params/ParamsIter#}; |
| 2 |
use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::strrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/::Bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/Bytes#; |
| 3 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::convertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/::TryFromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/TryFrom#; |
| 4 |
use stdrust-analyzer cargo std https://github.com/rust-lang/rust/library/std crate/::iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/; |
| 5 |
|
| 6 |
pub struct AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#<'a> { |
| 7 |
// The input bytes |
| 8 |
bytesrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#bytes.: Bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/Bytes#<'a>, |
| 9 |
|
| 10 |
// The state machine |
| 11 |
machinerust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#machine.: anstyle_parserust-analyzer cargo anstyle-parse 0.2.3 crate/::Parserrust-analyzer cargo anstyle-parse 0.2.3 Parser#, |
| 12 |
|
| 13 |
// Becomes non-None when the parser finishes parsing an ANSI sequence. |
| 14 |
// This is never Element::Text. |
| 15 |
elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#>, |
| 16 |
|
| 17 |
// Number of text bytes seen since the last element was emitted. |
| 18 |
text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length.: usize, |
| 19 |
|
| 20 |
// Byte offset of start of current element. |
| 21 |
startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start.: usize, |
| 22 |
|
| 23 |
// Byte offset of most rightward byte processed so far |
| 24 |
posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos.: usize, |
| 25 |
} |
| 26 |
|
| 27 |
#[deriverust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/derive:(Defaultrust-analyzer cargo core https://github.com/rust-lang/rust/library/core default/Default:)] |
| 28 |
struct Performerrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer# { |
| 29 |
// Becomes non-None when the parser finishes parsing an ANSI sequence. |
| 30 |
// This is never Element::Text. |
| 31 |
elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#element.: Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#>, |
| 32 |
|
| 33 |
// Number of text bytes seen since the last element was emitted. |
| 34 |
text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#text_length.: usize, |
| 35 |
} |
| 36 |
|
| 37 |
#[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:, 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:)] |
| 38 |
pub enum Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element# { |
| 39 |
Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#, usize, usize), |
| 40 |
Csirust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Csi#(usize, usize), |
| 41 |
Escrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Esc#(usize, usize), |
| 42 |
Oscrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Osc#(usize, usize), |
| 43 |
Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(usize, usize), |
| 44 |
} |
| 45 |
|
| 46 |
impl Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element# { |
| 47 |
fn set_rangerust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Element]set_range().(&mut self, start: usize, end: usize) { |
| 48 |
let (from, to) = match self { |
| 49 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(_, from, to) => (from, to), |
| 50 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Csirust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Csi#(from, to) => (from, to), |
| 51 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Escrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Esc#(from, to) => (from, to), |
| 52 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Oscrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Osc#(from, to) => (from, to), |
| 53 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(from, to) => (from, to), |
| 54 |
}; |
| 55 |
|
| 56 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().from = start; |
| 57 |
*rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&mut T`][Deref]deref().to = end; |
| 58 |
} |
| 59 |
} |
| 60 |
|
| 61 |
impl<'a> AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#<'a> { |
| 62 |
pub fn newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(s: &'a str) -> Selfrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`] { |
| 63 |
Selfrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`] { |
| 64 |
machinerust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#machine.: anstyle_parserust-analyzer cargo anstyle-parse 0.2.3 crate/::Parserrust-analyzer cargo anstyle-parse 0.2.3 Parser#::<anstyle_parserust-analyzer cargo anstyle-parse 0.2.3 crate/::DefaultCharAccumulatorrust-analyzer cargo anstyle-parse 0.2.3 DefaultCharAccumulator#>::newrust-analyzer cargo anstyle-parse 0.2.3 impl#[`Parser<C>`]new().(), |
| 65 |
bytesrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#bytes.: s.bytesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/impl#[str]bytes().(), |
| 66 |
elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element.: Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 67 |
text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length.: 0, |
| 68 |
startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start.: 0, |
| 69 |
posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos.: 0, |
| 70 |
} |
| 71 |
} |
| 72 |
|
| 73 |
fn advance_vterust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]advance_vte().(&mut self, byte: u8) { |
| 74 |
let mut performer = Performerrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#::defaultrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Default]default().(); |
| 75 |
self.machinerust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#machine..advancerust-analyzer cargo anstyle-parse 0.2.3 impl#[`Parser<C>`]advance().(&mut performer, byte); |
| 76 |
self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element. = performer.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#element.; |
| 77 |
self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().performer.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#text_length.; |
| 78 |
self.posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 79 |
} |
| 80 |
} |
| 81 |
|
| 82 |
impl Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator# for AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#<'_> { |
| 83 |
type Itemrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]Item# = Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#; |
| 84 |
|
| 85 |
fn nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().(&mut self) -> Optionrust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> { |
| 86 |
// If the last element emitted was text, then there may be a non-text element waiting |
| 87 |
// to be emitted. In that case we do not consume a new byte. |
| 88 |
while self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element..is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().() { |
| 89 |
match self.bytesrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#bytes..nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core str/iter/impl#[`Bytes<'_>`][Iterator]next().() { |
| 90 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(b) => self.advance_vterust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]advance_vte().(b), |
| 91 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# => break, |
| 92 |
} |
| 93 |
} |
| 94 |
|
| 95 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(mut element) = self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element..takerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]take().() { |
| 96 |
// There is a non-text element waiting to be emitted, but it may have preceding |
| 97 |
// text, which must be emitted first. |
| 98 |
if self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 99 |
let start = self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start.; |
| 100 |
self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length.; |
| 101 |
self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length. = 0; |
| 102 |
self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#element. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(element); |
| 103 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(start, self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start.)); |
| 104 |
} |
| 105 |
|
| 106 |
let start = self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start.; |
| 107 |
self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start. = self.posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos.; |
| 108 |
element.set_rangerust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Element]set_range().(start, self.posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos.); |
| 109 |
|
| 110 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(element); |
| 111 |
} |
| 112 |
|
| 113 |
if self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().0 { |
| 114 |
self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#text_length. = 0; |
| 115 |
return Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(self.startrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#start., self.posrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#pos.)); |
| 116 |
} |
| 117 |
|
| 118 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 119 |
} |
| 120 |
} |
| 121 |
|
| 122 |
// Based on https://github.com/alacritty/vte/blob/v0.9.0/examples/parselog.rs |
| 123 |
impl anstyle_parserust-analyzer cargo anstyle-parse 0.2.3 crate/::Performrust-analyzer cargo anstyle-parse 0.2.3 Perform# for Performerrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer# { |
| 124 |
fn csi_dispatchrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]csi_dispatch().(&mut self, params: &Paramsrust-analyzer cargo anstyle-parse 0.2.3 params/Params#, intermediates: &[u8], ignore: bool, byte: u8) { |
| 125 |
if ignore || intermediates.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().1 { |
| 126 |
return; |
| 127 |
} |
| 128 |
|
| 129 |
let is_sgr = byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialEq<Self>`]eq().b'm' && intermediates.is_emptyrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]is_empty().(); |
| 130 |
let element = if is_sgr { |
| 131 |
if params.is_emptyrust-analyzer cargo anstyle-parse 0.2.3 params/impl#[Params]is_empty().() { |
| 132 |
// Attr::Reset |
| 133 |
// Probably doesn't need to be handled: https://github.com/dandavison/delta/pull/431#discussion_r536883568 |
| 134 |
Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None# |
| 135 |
} else { |
| 136 |
let style = ansi_term_style_from_sgr_parametersrust-analyzer cargo git-delta 0.19.2 ansi/iterator/ansi_term_style_from_sgr_parameters().(&mut params.iterrust-analyzer cargo anstyle-parse 0.2.3 params/impl#[Params]iter().()); |
| 137 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(style, 0, 0)) |
| 138 |
} |
| 139 |
} else { |
| 140 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Csirust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Csi#(0, 0)) |
| 141 |
}; |
| 142 |
|
| 143 |
self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#element. = element; |
| 144 |
} |
| 145 |
|
| 146 |
fn printrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]print().(&mut self, c: char) { |
| 147 |
self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#text_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().c.len_utf8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core char/methods/impl#[char]len_utf8().(); |
| 148 |
} |
| 149 |
|
| 150 |
fn executerust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]execute().(&mut self, byte: u8) { |
| 151 |
// E.g. '\n' |
| 152 |
if byte rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().<rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[u8][`PartialOrd<Self>`]lt().128 { |
| 153 |
self.text_lengthrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#text_length. rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().+=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[usize][`AddAssign<Self>`]add_assign().1; |
| 154 |
} |
| 155 |
} |
| 156 |
|
| 157 |
fn hookrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]hook().(&mut self, _params: &Paramsrust-analyzer cargo anstyle-parse 0.2.3 params/Params#, _intermediates: &[u8], _ignore: bool, _byte: u8) {} |
| 158 |
|
| 159 |
fn putrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]put().(&mut self, _byte: u8) {} |
| 160 |
|
| 161 |
fn unhookrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]unhook().(&mut self) {} |
| 162 |
|
| 163 |
fn osc_dispatchrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]osc_dispatch().(&mut self, _params: &[&[u8]], _bell_terminated: bool) { |
| 164 |
self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#element. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Oscrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Osc#(0, 0)); |
| 165 |
} |
| 166 |
|
| 167 |
fn esc_dispatchrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[Performer][Perform]esc_dispatch().(&mut self, _intermediates: &[u8], _ignore: bool, _byte: u8) { |
| 168 |
self.elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Performer#element. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Escrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Esc#(0, 0)); |
| 169 |
} |
| 170 |
} |
| 171 |
|
| 172 |
// Based on https://github.com/alacritty/alacritty/blob/9e71002e40d5487c6fa2571a3a3c4f5c8f679334/alacritty_terminal/src/ansi.rs#L1175 |
| 173 |
fn ansi_term_style_from_sgr_parametersrust-analyzer cargo git-delta 0.19.2 ansi/iterator/ansi_term_style_from_sgr_parameters().(params: &mut ParamsIterrust-analyzer cargo anstyle-parse 0.2.3 params/ParamsIter#<'_>) -> ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 174 |
let mut 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().(); |
| 175 |
while let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(param) = params.nextrust-analyzer cargo anstyle-parse 0.2.3 params/impl#[`ParamsIter<'a>`][Iterator]next().() { |
| 176 |
match param { |
| 177 |
// [0] => Some(Attr::Reset), |
| 178 |
[1] => style.is_boldrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_bold. = true, |
| 179 |
[2] => style.is_dimmedrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_dimmed. = true, |
| 180 |
[3] => style.is_italicrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_italic. = true, |
| 181 |
[4, ..] => style.is_underlinerust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_underline. = true, |
| 182 |
[5] => style.is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink. = true, // blink slow |
| 183 |
[6] => style.is_blinkrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_blink. = true, // blink fast |
| 184 |
[7] => style.is_reverserust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_reverse. = true, |
| 185 |
[8] => style.is_hiddenrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_hidden. = true, |
| 186 |
[9] => style.is_strikethroughrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#is_strikethrough. = true, |
| 187 |
// [21] => Some(Attr::CancelBold), |
| 188 |
// [22] => Some(Attr::CancelBoldDim), |
| 189 |
// [23] => Some(Attr::CancelItalic), |
| 190 |
// [24] => Some(Attr::CancelUnderline), |
| 191 |
// [25] => Some(Attr::CancelBlink), |
| 192 |
// [27] => Some(Attr::CancelReverse), |
| 193 |
// [28] => Some(Attr::CancelHidden), |
| 194 |
// [29] => Some(Attr::CancelStrike), |
| 195 |
[30] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 196 |
[31] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 197 |
[32] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 198 |
[33] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 199 |
[34] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 200 |
[35] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 201 |
[36] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 202 |
[37] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 203 |
[38] => { |
| 204 |
let mut iter = params.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|param| param[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 205 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = parse_sgr_colorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/parse_sgr_color().(&mut iter) { |
| 206 |
style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color); |
| 207 |
} |
| 208 |
} |
| 209 |
[38, params @ ..] => { |
| 210 |
let rgb_start = if params.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().4 { 2 } else { 1 }; |
| 211 |
let rgb_iter = params[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().rgb_start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().(); |
| 212 |
let mut iter = iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(params[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(rgb_iter); |
| 213 |
|
| 214 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = parse_sgr_colorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/parse_sgr_color().(&mut iter) { |
| 215 |
style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color); |
| 216 |
} |
| 217 |
} |
| 218 |
// [39] => Some(Attr::Foreground(Color::Named(NamedColor::Foreground))), |
| 219 |
[40] => style.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#(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#), |
| 220 |
[41] => style.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#(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#), |
| 221 |
[42] => style.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#(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#), |
| 222 |
[43] => style.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#(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#), |
| 223 |
[44] => style.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#(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#), |
| 224 |
[45] => style.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#(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#), |
| 225 |
[46] => style.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#(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#), |
| 226 |
[47] => style.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#(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#), |
| 227 |
[48] => { |
| 228 |
let mut iter = params.maprust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#map().(|param| param[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 229 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = parse_sgr_colorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/parse_sgr_color().(&mut iter) { |
| 230 |
style.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); |
| 231 |
} |
| 232 |
} |
| 233 |
[48, params @ ..] => { |
| 234 |
let rgb_start = if params.lenrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]len().() rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[usize][`PartialOrd<Self>`]gt().4 { 2 } else { 1 }; |
| 235 |
let rgb_iter = params[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().rgb_start..rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/range/RangeFrom#]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()..iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core slice/impl#[`[T]`]iter().().copiedrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#copied().(); |
| 236 |
let mut iter = iterrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/::oncerust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/sources/once/once().(params[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().).chainrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#chain().(rgb_iter); |
| 237 |
if let Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(color) = parse_sgr_colorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/parse_sgr_color().(&mut iter) { |
| 238 |
style.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); |
| 239 |
} |
| 240 |
} |
| 241 |
// [49] => Some(Attr::Background(Color::Named(NamedColor::Background))), |
| 242 |
// "bright" colors. ansi_term doesn't offer a way to emit them as, e.g., 90m; instead |
| 243 |
// that would be 38;5;8. |
| 244 |
[90] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 245 |
[91] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 246 |
[92] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 247 |
[93] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 248 |
[94] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 249 |
[95] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 250 |
[96] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 251 |
[97] => style.foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground. = Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 252 |
[100] => style.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#(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)), |
| 253 |
[101] => style.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#(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)), |
| 254 |
[102] => style.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#(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)), |
| 255 |
[103] => style.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#(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)), |
| 256 |
[104] => style.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#(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)), |
| 257 |
[105] => style.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#(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)), |
| 258 |
[106] => style.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#(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)), |
| 259 |
[107] => style.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#(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)), |
| 260 |
_ => {} |
| 261 |
}; |
| 262 |
} |
| 263 |
style |
| 264 |
} |
| 265 |
|
| 266 |
// Based on https://github.com/alacritty/alacritty/blob/57c4ac9145a20fb1ae9a21102503458d3da06c7b/alacritty_terminal/src/ansi.rs#L1258 |
| 267 |
fn parse_sgr_colorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/parse_sgr_color().(params: &mut dyn Iteratorrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#<Itemrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#Item# = u16>) -> 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#> { |
| 268 |
match params.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().() { |
| 269 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(2) => { |
| 270 |
let r = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u16>`]try_from().(params.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 271 |
let g = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u16>`]try_from().(params.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| 272 |
let b = u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u16>`]try_from().(params.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().; |
| •273 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)) |
| 274 |
} |
| 275 |
Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(5) => Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#(u8::try_fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/num/impl#[u8][`TryFrom<u16>`]try_from().(params.nextrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#next().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().).okrust-analyzer cargo core https://github.com/rust-lang/rust/library/core result/impl#[`Result<T, E>`]ok().()?rust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`][Try]branch().)), |
| 276 |
_ => Nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#None#, |
| 277 |
} |
| 278 |
} |
| 279 |
|
| 280 |
#[cfg(test)] |
| 281 |
mod testsrust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/ { |
| 282 |
|
| 283 |
use superrust-analyzer cargo git-delta 0.19.2 ansi/iterator/::{AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#, Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#}; |
| 284 |
use craterust-analyzer cargo git-delta 0.19.2 crate/::stylerust-analyzer cargo git-delta 0.19.2 style/; |
| 285 |
|
| 286 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 287 |
fn test_iterator_parse_git_style_stringsrust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_parse_git_style_strings().() { |
| 288 |
for (git_style_string, git_output) in &*rust-analyzer cargo git-delta 0.19.2 style/tests/impl#[GIT_STYLE_STRING_EXAMPLES][Deref]deref().stylerust-analyzer cargo git-delta 0.19.2 style/::testsrust-analyzer cargo git-delta 0.19.2 style/tests/::GIT_STYLE_STRING_EXAMPLESrust-analyzer cargo git-delta 0.19.2 style/tests/GIT_STYLE_STRING_EXAMPLES. { |
| 289 |
let mut it = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(git_output); |
| 290 |
|
| 291 |
if *rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/deref/impl#[`&T`][Deref]deref().git_style_string rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[`&A`][`PartialEq<&B>`]eq()."normal" { |
| 292 |
// This one has a different pattern |
| 293 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 294 |
matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(s, _, _) if s == 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().()) |
| 295 |
); |
| 296 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 297 |
matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(i, j) if &git_output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == "text") |
| 298 |
); |
| 299 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!( |
| 300 |
matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!(it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(s, _, _) if s == 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().()) |
| 301 |
); |
| 302 |
continue; |
| 303 |
} |
| 304 |
|
| 305 |
// First element should be a style |
| 306 |
let element = it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 307 |
match element { |
| 308 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(style, _, _) => assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(stylerust-analyzer cargo git-delta 0.19.2 style/::ansi_term_style_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality().( |
| 309 |
style, |
| 310 |
stylerust-analyzer cargo git-delta 0.19.2 style/::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).ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style. |
| 311 |
)), |
| 312 |
_ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 313 |
} |
| 314 |
|
| 315 |
// Second element should be text: "+" |
| 316 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 317 |
it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 318 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(i, j) if &git_output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == "+")); |
| 319 |
|
| 320 |
// Third element is the reset style |
| 321 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 322 |
it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 323 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(s, _, _) if s == 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().())); |
| 324 |
|
| 325 |
// Fourth element should be a style |
| 326 |
let element = it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(); |
| 327 |
match element { |
| 328 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(style, _, _) => assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(stylerust-analyzer cargo git-delta 0.19.2 style/::ansi_term_style_equalityrust-analyzer cargo git-delta 0.19.2 style/ansi_term_style_equality().( |
| 329 |
style, |
| 330 |
stylerust-analyzer cargo git-delta 0.19.2 style/::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).ansi_term_stylerust-analyzer cargo git-delta 0.19.2 style/Style#ansi_term_style. |
| 331 |
)), |
| 332 |
_ => unreachablerust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/unreachable!!(), |
| 333 |
} |
| 334 |
|
| 335 |
// Fifth element should be text: "text" |
| 336 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 337 |
it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 338 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(i, j) if &git_output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == "text")); |
| 339 |
|
| 340 |
// Sixth element is the reset style |
| 341 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 342 |
it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 343 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(s, _, _) if s == 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().())); |
| 344 |
|
| 345 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(matchesrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/matches!!( |
| 346 |
it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().unwraprust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]unwrap().(), |
| 347 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(i, j) if &git_output[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().i..j]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index(). == "\n")); |
| 348 |
|
| 349 |
assertrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/assert!!(it.nextrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'_>`][Iterator]next().().is_nonerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/impl#[`Option<T>`]is_none().()); |
| 350 |
} |
| 351 |
} |
| 352 |
|
| 353 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 354 |
fn test_iterator_1rust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_1().() { |
| 355 |
let minus_line = "\x1b[31m0123\x1b[m\n"; |
| 356 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(minus_line).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 357 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 358 |
actual_elements, |
| 359 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 360 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#( |
| 361 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 362 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 363 |
..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().() |
| 364 |
}, |
| 365 |
0, |
| 366 |
5 |
| 367 |
), |
| 368 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(5, 9), |
| 369 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 9, 12), |
| 370 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(12, 13), |
| 371 |
] |
| 372 |
); |
| 373 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0123", &minus_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5..9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 374 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("\n", &minus_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12..13]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 375 |
} |
| 376 |
|
| 377 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 378 |
fn test_iterator_2rust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_2().() { |
| 379 |
let minus_line = "\x1b[31m0123\x1b[m456\n"; |
| 380 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(minus_line).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 381 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 382 |
actual_elements, |
| 383 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 384 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#( |
| 385 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 386 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 387 |
..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().() |
| 388 |
}, |
| 389 |
0, |
| 390 |
5 |
| 391 |
), |
| 392 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(5, 9), |
| 393 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 9, 12), |
| 394 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(12, 16), |
| 395 |
] |
| 396 |
); |
| 397 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("0123", &minus_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5..9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 398 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("456\n", &minus_line[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().12..16]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 399 |
} |
| 400 |
|
| 401 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 402 |
fn test_iterator_styled_non_asciirust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_styled_non_ascii().() { |
| 403 |
let s = "\x1b[31mバー\x1b[0m"; |
| 404 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(s).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 405 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 406 |
actual_elements, |
| 407 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 408 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#( |
| 409 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 410 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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#), |
| 411 |
..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().() |
| 412 |
}, |
| 413 |
0, |
| 414 |
5 |
| 415 |
), |
| 416 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(5, 11), |
| 417 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 11, 15), |
| 418 |
] |
| 419 |
); |
| 420 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("バー", &s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().5..11]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 421 |
} |
| 422 |
|
| 423 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 424 |
fn test_iterator_erase_in_linerust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_erase_in_line().() { |
| 425 |
let s = "\x1b[0Kあ.\x1b[m"; |
| 426 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(s).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 427 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 428 |
actual_elements, |
| 429 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 430 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Csirust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Csi#(0, 4), |
| 431 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(4, 8), |
| 432 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 8, 11), |
| 433 |
] |
| 434 |
); |
| 435 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("あ.", &s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().4..8]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 436 |
} |
| 437 |
|
| 438 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 439 |
fn test_iterator_erase_in_line_without_nrust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_erase_in_line_without_n().() { |
| 440 |
let s = "\x1b[Kあ.\x1b[m"; |
| 441 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(s).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 442 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 443 |
actual_elements, |
| 444 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 445 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Csirust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Csi#(0, 3), |
| 446 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(3, 7), |
| 447 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 7, 10), |
| 448 |
] |
| 449 |
); |
| 450 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!("あ.", &s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().3..7]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().); |
| 451 |
} |
| 452 |
|
| 453 |
#[testrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/builtin/test:] |
| 454 |
fn test_iterator_osc_hyperlinks_styled_non_asciirust-analyzer cargo git-delta 0.19.2 ansi/iterator/tests/test_iterator_osc_hyperlinks_styled_non_ascii().() { |
| 455 |
let s = "\x1b[38;5;4m\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b\\src/ansi/modバー.rs\x1b]8;;\x1b\\\x1b[0m\n"; |
| 456 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().0..9]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\x1b[38;5;4m"); |
| 457 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 458 |
&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().9..58]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., |
| 459 |
"\x1b]8;;file:///Users/dan/src/delta/src/ansi/mod.rs\x1b" |
| 460 |
); |
| 461 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().58..59]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\\"); |
| 462 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().59..80]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "src/ansi/modバー.rs"); |
| 463 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().80..86]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\x1b]8;;\x1b"); |
| 464 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().86..87]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\\"); |
| 465 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().87..91]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\x1b[0m"); |
| 466 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!(&s[rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index().91..92]rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/index/Index#index()., "\n"); |
| 467 |
let actual_elements: Vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc vec/Vec#<Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#> = AnsiElementIteratorrust-analyzer cargo git-delta 0.19.2 ansi/iterator/AnsiElementIterator#::newrust-analyzer cargo git-delta 0.19.2 ansi/iterator/impl#[`AnsiElementIterator<'a>`]new().(s).collectrust-analyzer cargo core https://github.com/rust-lang/rust/library/core iter/traits/iterator/Iterator#collect().(); |
| 468 |
assert_eqrust-analyzer cargo core https://github.com/rust-lang/rust/library/core macros/assert_eq!!( |
| 469 |
actual_elements, |
| 470 |
vecrust-analyzer cargo alloc https://github.com/rust-lang/rust/library/alloc macros/vec!![ |
| 471 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#( |
| 472 |
ansi_termrust-analyzer cargo nu-ansi-term 0.50.3 crate/::Stylerust-analyzer cargo nu-ansi-term 0.50.3 style/Style# { |
| 473 |
foregroundrust-analyzer cargo nu-ansi-term 0.50.3 style/Style#foreground.: Somerust-analyzer cargo core https://github.com/rust-lang/rust/library/core option/Option#Some#(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)), |
| 474 |
..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().() |
| 475 |
}, |
| 476 |
0, |
| 477 |
9 |
| 478 |
), |
| 479 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Oscrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Osc#(9, 58), |
| 480 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Escrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Esc#(58, 59), |
| 481 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(59, 80), |
| 482 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Oscrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Osc#(80, 86), |
| 483 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Escrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Esc#(86, 87), |
| 484 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Sgrrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Sgr#(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().(), 87, 91), |
| 485 |
Elementrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#::Textrust-analyzer cargo git-delta 0.19.2 ansi/iterator/Element#Text#(91, 92), |
| 486 |
] |
| 487 |
); |
| 488 |
} |
| 489 |
} |