From a5a7dc14e430ed3f097cbef60abaa3bb19161cdc Mon Sep 17 00:00:00 2001 From: eth-p <32112321+eth-p@users.noreply.github.com> Date: Mon, 14 May 2018 14:36:08 -0700 Subject: [PATCH] Fix \r character being printed with wrapping enabled. --- src/printer.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/printer.rs b/src/printer.rs index fbf6658b..0eda7df2 100644 --- a/src/printer.rs +++ b/src/printer.rs @@ -142,8 +142,9 @@ impl<'a> Printer<'a> { )?; } else { for &(style, text) in regions.iter() { - let mut chars = text.chars().filter(|c| *c != '\n'); - let mut remaining = text.chars().filter(|c| *c != '\n').count(); + let text = text.trim_right_matches(|c| c == '\r' || c == '\n'); + let mut chars = text.chars(); + let mut remaining = text.chars().count(); while remaining > 0 { let available = cursor_max - cursor;