on master help sign in
Replace iterator with string starts_with and ends_with
commit2b9d25df052e50c60531b1000703b79bf9b6065a authorEthan P <eth-p+git@hidden.email> dateFri 10 May 2019, 14:15 (8 years ago) parentcc81861
1 file changed+2−3
src/printer.rs+2−3
src/printer.rs+2−3
@@ -367,10 +367,9 @@ impl<'a> Printer for InteractivePrinter<'a> {
367367 match chunk {
368368 // ANSI escape passthrough.
369369 (text, true) => {
370− let is_ansi_csi =
371− text.chars().skip(1).nth(0).map_or(false, |c| c == '[');
370+ let is_ansi_csi = text.starts_with("\x1B[");
372371
373− if is_ansi_csi && text.chars().last().map_or(false, |c| c == 'm') {
372+ if is_ansi_csi && text.ends_with('m') {
374373 // It's an ANSI SGR sequence.
375374 // We should be mostly safe to just append these together.
376375 ansi_prefix.push_str(text);