diff options
author | Dan Davison <dandavison7@gmail.com> | 2020-08-01 22:58:27 -0400 |
---|---|---|
committer | Dan Davison <dandavison7@gmail.com> | 2020-08-01 22:58:27 -0400 |
commit | 4a2ddc430e88bb6454032c8d2cfc4f7d3485b8d8 (patch) | |
tree | dd37fd455508c93bc1c0cca6ddfedd1f3d8a8b1b /src/ansi | |
parent | a0853ca53ee622d159f39e0d9e0d84523252381a (diff) |
Change parse_first_style() to take &str instead of bytes iterator
Diffstat (limited to 'src/ansi')
-rw-r--r-- | src/ansi/parse.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ansi/parse.rs b/src/ansi/parse.rs index 60973b94..94d902c4 100644 --- a/src/ansi/parse.rs +++ b/src/ansi/parse.rs @@ -1,10 +1,10 @@ use ansi_term; use vte; -pub fn parse_first_style(bytes: impl Iterator<Item = u8>) -> Option<ansi_term::Style> { +pub fn parse_first_style(s: &str) -> Option<ansi_term::Style> { let mut machine = vte::Parser::new(); let mut performer = Performer { style: None }; - for b in bytes { + for b in s.bytes() { if performer.style.is_some() { return performer.style; } @@ -195,7 +195,7 @@ mod tests { #[test] fn test_parse_first_style() { let minus_line_from_unconfigured_git = "\x1b[31m-____\x1b[m\n"; - let style = parse_first_style(minus_line_from_unconfigured_git.bytes()); + let style = parse_first_style(minus_line_from_unconfigured_git); let expected_style = ansi_term::Style { foreground: Some(ansi_term::Color::Red), ..ansi_term::Style::default() |