From 2b9d25df052e50c60531b1000703b79bf9b6065a Mon Sep 17 00:00:00 2001 From: Ethan P Date: Fri, 10 May 2019 14:15:47 -0700 Subject: [PATCH] Replace iterator with string starts_with and ends_with --- src/printer.rs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index 1ba86b68..880a8b4e 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -367,10 +367,9 @@ impl<'a> Printer for InteractivePrinter<'a> { match chunk { // ANSI escape passthrough. (text, true) => { - let is_ansi_csi = - text.chars().skip(1).nth(0).map_or(false, |c| c == '['); + let is_ansi_csi = text.starts_with("\x1B["); - if is_ansi_csi && text.chars().last().map_or(false, |c| c == 'm') { + if is_ansi_csi && text.ends_with('m') { // It's an ANSI SGR sequence. // We should be mostly safe to just append these together. ansi_prefix.push_str(text);