From 36113ce9f75ff52901ddd90e8a41225a2f258c63 Mon Sep 17 00:00:00 2001 From: Gerrit Viljoen Date: Sun, 17 May 2020 12:26:38 +0200 Subject: [PATCH] save game --- src/lib.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 315f2b3..2570ae5 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -360,12 +360,19 @@ impl SmartString { } buf.push(ch); } else { - if ch != '\u{1b}' && ch != '[' && ch != ';' && ch != 'm' && !('0'..'9').contains(&ch) { + if ch == 'm' { + buf.push(ch); fragments.push((visible, buf)); visible = !visible; buf = String::new(); + } else if ch != '[' && ch != ';' && !('0'..'9').contains(&ch) { + fragments.push((visible, buf)); + visible = !visible; + buf = String::new(); + buf.push(ch); + } else { + buf.push(ch); } - buf.push(ch); } } if !buf.is_empty() {