Skip to content

Commit 416818f

Browse files
authored
Merge pull request ogham#597 from FliegendeWurst/bugfixes
Two small bugfixes
2 parents d13cce7 + 6010ed5 commit 416818f

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

src/options/view.rs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ impl Mode {
8181

8282
// If the terminal width couldn’t be matched for some reason, such
8383
// as the program’s stdout being connected to a file, then
84-
// fallback to the lines view.
84+
// fallback to the lines or details view.
8585
else if matches.has(&flags::TREE)? {
8686
let details = details::Options {
8787
table: None,
@@ -92,7 +92,10 @@ impl Mode {
9292

9393
Ok(Mode::Details(details))
9494
}
95-
else {
95+
else if matches.has(&flags::LONG)? {
96+
let details = long()?;
97+
Ok(Mode::Details(details))
98+
} else {
9699
let lines = lines::Options { icons: matches.has(&flags::ICONS)?, };
97100
Ok(Mode::Lines(lines))
98101
}

src/output/escape.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,15 @@ use ansi_term::{ANSIString, Style};
22

33

44
pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, bad: Style) {
5-
if string.chars().all(|c| c >= 0x20 as char) {
5+
if string.chars().all(|c| c >= 0x20 as char && c != 0x7f as char) {
66
bits.push(good.paint(string));
77
}
88
else {
99
for c in string.chars() {
1010
// The `escape_default` method on `char` is *almost* what we want here, but
1111
// it still escapes non-ASCII UTF-8 characters, which are still printable.
1212

13-
if c >= 0x20 as char {
13+
if c >= 0x20 as char && c != 0x7f as char {
1414
// TODO: This allocates way too much,
1515
// hence the `all` check above.
1616
let mut s = String::new();

0 commit comments

Comments
 (0)