Replace iterator with string starts_with and ends_with

pull/564/head
Ethan P 5 years ago committed by David Peter
parent cc8186103b
commit 2b9d25df05

@ -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);

Loading…
Cancel
Save