mirror of
https://github.com/Llewellynvdm/exa.git
synced 2024-11-22 20:15:11 +00:00
Merge pull request #597 from FliegendeWurst/bugfixes
Two small bugfixes
This commit is contained in:
commit
416818fda2
@ -81,7 +81,7 @@ impl Mode {
|
|||||||
|
|
||||||
// If the terminal width couldn’t be matched for some reason, such
|
// If the terminal width couldn’t be matched for some reason, such
|
||||||
// as the program’s stdout being connected to a file, then
|
// as the program’s stdout being connected to a file, then
|
||||||
// fallback to the lines view.
|
// fallback to the lines or details view.
|
||||||
else if matches.has(&flags::TREE)? {
|
else if matches.has(&flags::TREE)? {
|
||||||
let details = details::Options {
|
let details = details::Options {
|
||||||
table: None,
|
table: None,
|
||||||
@ -92,7 +92,10 @@ impl Mode {
|
|||||||
|
|
||||||
Ok(Mode::Details(details))
|
Ok(Mode::Details(details))
|
||||||
}
|
}
|
||||||
else {
|
else if matches.has(&flags::LONG)? {
|
||||||
|
let details = long()?;
|
||||||
|
Ok(Mode::Details(details))
|
||||||
|
} else {
|
||||||
let lines = lines::Options { icons: matches.has(&flags::ICONS)?, };
|
let lines = lines::Options { icons: matches.has(&flags::ICONS)?, };
|
||||||
Ok(Mode::Lines(lines))
|
Ok(Mode::Lines(lines))
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,7 @@ use ansi_term::{ANSIString, Style};
|
|||||||
|
|
||||||
|
|
||||||
pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, bad: Style) {
|
pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, 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));
|
bits.push(good.paint(string));
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -10,7 +10,7 @@ pub fn escape<'a>(string: String, bits: &mut Vec<ANSIString<'a>>, good: Style, b
|
|||||||
// The `escape_default` method on `char` is *almost* what we want here, but
|
// 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.
|
// 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,
|
// TODO: This allocates way too much,
|
||||||
// hence the `all` check above.
|
// hence the `all` check above.
|
||||||
let mut s = String::new();
|
let mut s = String::new();
|
||||||
|
Loading…
Reference in New Issue
Block a user