From c43a58d9d677e3f35e46bf2f5fc566dc8d1aff5d Mon Sep 17 00:00:00 2001 From: equal-l2 Date: Wed, 19 Feb 2020 23:57:58 +0900 Subject: [PATCH] Fix incorrect display for zero-size files (#1422) --- src/data/base/shape.rs | 4 ---- src/data/files.rs | 4 ++-- src/data/primitive.rs | 1 - 3 files changed, 2 insertions(+), 7 deletions(-) diff --git a/src/data/base/shape.rs b/src/data/base/shape.rs index 67d02bb12e..f33596b32f 100644 --- a/src/data/base/shape.rs +++ b/src/data/base/shape.rs @@ -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() { diff --git a/src/data/files.rs b/src/data/files.rs index 5fb93bdce1..14581e3e4d 100644 --- a/src/data/files.rs +++ b/src/data/files.rs @@ -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 { diff --git a/src/data/primitive.rs b/src/data/primitive.rs index b34af13d01..42b5d27983 100644 --- a/src/data/primitive.rs +++ b/src/data/primitive.rs @@ -12,7 +12,6 @@ pub fn number(number: impl Into) -> 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", _ => "", }