save game

This commit is contained in:
Gerrit Viljoen 2020-05-17 12:32:15 +02:00
parent 481ede8a6f
commit d84a0de943
2 changed files with 22 additions and 1 deletions

View File

@ -365,7 +365,7 @@ impl SmartString {
fragments.push((visible, buf)); fragments.push((visible, buf));
visible = !visible; visible = !visible;
buf = String::new(); buf = String::new();
} else if ch != '[' && ch != ';' && !('0'..'9').contains(&ch) { } else if ch != '[' && ch != ';' && !('0'..='9').contains(&ch) {
fragments.push((visible, buf)); fragments.push((visible, buf));
visible = !visible; visible = !visible;
buf = String::new(); buf = String::new();
@ -378,6 +378,7 @@ impl SmartString {
if !buf.is_empty() { if !buf.is_empty() {
fragments.push((visible, buf)); fragments.push((visible, buf));
} }
println!("FRAGMENTS: {:?}", fragments);
Self { fragments } Self { fragments }
} }

View File

@ -615,6 +615,26 @@ fn color_codes() {
assert_eq!(expected, config.format(input)); assert_eq!(expected, config.format(input));
} }
// \u{1b}[38;2;255;0;0mH
// \u{1b}[38;2;255;6;0me
// \u{1b}[38;2;255;13;0ml
// \u{1b}[38;2;255;19;0ml
// \u{1b}[38;2;255;26;0mo
// \u{1b}[0m
// (true, ""),
// (false, "\u{1b}[38;2;255;0;0m"),
// (true, "H"),
// (false, "\u{1b}[38;2;255;6;0m"),
// (true, "e"),
// (false, "\u{1b}[38;2;255;13;0m"),
// (true, "l"),
// (false, "\u{1b}[38;2;255;1"),
// (true, "9;0ml"),
// (false, "\u{1b}[38;2;255;26;0m"),
// (true, "o"),
// (false, "\u{1b}[0m")
#[test] #[test]
fn color_codes_in_header() { fn color_codes_in_header() {
let mut config = AsciiTable::default(); let mut config = AsciiTable::default();