From 0cf6df48005f23f47b95a03f24782e9027211ac9 Mon Sep 17 00:00:00 2001 From: Dr Maxim Orlovsky Date: Wed, 6 Mar 2024 19:33:32 +0100 Subject: [PATCH] data: remove control characters from ByteStr repr --- src/data/byte_str.rs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/data/byte_str.rs b/src/data/byte_str.rs index d79dcc5..f8d3972 100644 --- a/src/data/byte_str.rs +++ b/src/data/byte_str.rs @@ -221,9 +221,8 @@ impl Display for ByteStr { let mut ctl = false; for c in s.chars() { let v = c as u32; - if c.is_control() || v <= 0x21 || v >= 0x7F { + if (c.is_control() && v != 0x20) || v < 0x20 || v >= 0x7F { if !ctl { - f.write_str("\x1B[2;3m<\x1B[1m")?; ctl = true; } if v <= 0xFF { @@ -235,15 +234,11 @@ impl Display for ByteStr { } } else { if ctl { - f.write_str("\x1B[2m>\x1B[1;23m")?; ctl = false; } f.write_char(c)?; } } - if ctl { - f.write_str("\x1B[2m>\x1B[1;23m")?; - } f.write_str("\"") } else { f.write_str(&self.as_ref().to_hex())