From b5b731071c2e323a40f34b2e8252e657f90fdb78 Mon Sep 17 00:00:00 2001 From: FliegendeWurst <2012gdwu@web.de> Date: Sat, 12 Oct 2019 11:42:12 +0200 Subject: [PATCH] Escape the delete character in filenames --- src/output/escape.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/output/escape.rs b/src/output/escape.rs index 161c393..e6fb38d 100644 --- a/src/output/escape.rs +++ b/src/output/escape.rs @@ -2,7 +2,7 @@ use ansi_term::{ANSIString, Style}; pub fn escape<'a>(string: String, bits: &mut Vec>, good: Style, bad: Style) { - if string.chars().all(|c| c >= 0x20 as char) { + if string.chars().all(|c| c >= 0x20 as char && c != 0x7f as char) { bits.push(good.paint(string)); } else { @@ -10,7 +10,7 @@ pub fn escape<'a>(string: String, bits: &mut Vec>, good: Style, b // The `escape_default` method on `char` is *almost* what we want here, but // it still escapes non-ASCII UTF-8 characters, which are still printable. - if c >= 0x20 as char { + if c >= 0x20 as char && c != 0x7f as char { // TODO: This allocates way too much, // hence the `all` check above. let mut s = String::new();