diff options
author | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-06-21 21:41:04 -0400 |
---|---|---|
committer | Jeff Zhao <jeff.no.zhao@gmail.com> | 2021-06-21 21:41:04 -0400 |
commit | 72aaf0c5d10db0004d48e27c58d18d8f2c568f8f (patch) | |
tree | f04ad2bd4bfe6bd58b48677dc19dc4599d18faa3 /src/ui/widgets/tui_dirlist_detailed.rs | |
parent | a4b4a1b4b9c7827f756e9950d73dc885d2954ff9 (diff) |
fix not displaying directories without proper permissions
- e.g. /root does not appear because we can't count
the number of items inside it
- add a space padding to the file size/directory size
Diffstat (limited to 'src/ui/widgets/tui_dirlist_detailed.rs')
-rw-r--r-- | src/ui/widgets/tui_dirlist_detailed.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ui/widgets/tui_dirlist_detailed.rs b/src/ui/widgets/tui_dirlist_detailed.rs index 08777ed..16dec1a 100644 --- a/src/ui/widgets/tui_dirlist_detailed.rs +++ b/src/ui/widgets/tui_dirlist_detailed.rs @@ -84,8 +84,8 @@ fn print_entry( FileType::Directory => entry .metadata .directory_size() - .expect("Directory doesn't have size") - .to_string(), + .map(|n| n.to_string()) + .unwrap_or("".to_string()), FileType::File => format::file_size_to_string(entry.metadata.len()), }; let symlink_string = match entry.metadata.link_type() { @@ -93,7 +93,7 @@ fn print_entry( LinkType::Symlink(_) => "-> ", }; let left_label_original = entry.label(); - let right_label_original = format!(" {}{}", symlink_string, size_string); + let right_label_original = format!(" {}{} ", symlink_string, size_string); let (left_label, right_label) = factor_labels_for_entry( left_label_original, |