Fix incorrect display for zero-size files (#1422)

This commit is contained in:
equal-l2 2020-02-19 23:57:58 +09:00 committed by GitHub
parent e38442782e
commit c43a58d9d6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 2 additions and 7 deletions

View File

@ -156,10 +156,6 @@ impl PrettyDebug for FormatInlineShape {
InlineShape::Bytesize(bytesize) => {
let byte = byte_unit::Byte::from_bytes(*bytesize as u128);
if byte.get_bytes() == 0u128 {
return b::description("".to_string());
}
let byte = byte.get_appropriate_unit(false);
match byte.get_unit() {

View File

@ -38,7 +38,7 @@ pub(crate) fn dir_entry_dict(
if full || with_symlink_targets {
if metadata.is_dir() || metadata.is_file() {
dict.insert_untagged("target", UntaggedValue::bytes(0u64));
dict.insert_untagged("target", UntaggedValue::nothing());
} else if let Ok(path_to_link) = filename.read_link() {
dict.insert_untagged(
"target",
@ -84,7 +84,7 @@ pub(crate) fn dir_entry_dict(
if metadata.is_file() {
dict.insert_untagged("size", UntaggedValue::bytes(metadata.len() as u64));
} else {
dict.insert_untagged("size", UntaggedValue::bytes(0u64));
dict.insert_untagged("size", UntaggedValue::nothing());
}
if full {

View File

@ -12,7 +12,6 @@ pub fn number(number: impl Into<Number>) -> Primitive {
pub fn style_primitive(primitive: &Primitive) -> &'static str {
match primitive {
Primitive::Bytes(0) => "c", // centre 'missing' indicator
Primitive::Int(_) | Primitive::Bytes(_) | Primitive::Decimal(_) => "r",
_ => "",
}