diff options
author | Canop <cano.petrole@gmail.com> | 2020-11-30 17:49:18 +0100 |
---|---|---|
committer | Canop <cano.petrole@gmail.com> | 2020-11-30 17:49:18 +0100 |
commit | 2fd09de426e8f7623180a834244330a0ec3f069a (patch) | |
tree | 2d2342eb246ae6f567c38c9c8695e0f54a291586 /src/display | |
parent | a5f599a10771a7a05c40dec8989357f65621d2b6 (diff) |
when sizes are displayed (eg on `br -s`) show size of root line and root filesystem info
Diffstat (limited to 'src/display')
-rw-r--r-- | src/display/displayable_tree.rs | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/display/displayable_tree.rs b/src/display/displayable_tree.rs index 8552066..afea69b 100644 --- a/src/display/displayable_tree.rs +++ b/src/display/displayable_tree.rs @@ -322,7 +322,16 @@ impl<'s, 't> DisplayableTree<'s, 't> { selected: bool, ) -> Result<(), ProgramError> { cond_bg!(style, self, selected, self.skin.directory); - let title = self.tree.lines[0].path.to_string_lossy(); + let line = &self.tree.lines[0]; + if self.tree.options.show_sizes { + if let Some(s) = line.sum { + cw.queue_g_string( + style, + format!("{:>4} ", file_size::fit_4(s.to_size())), + )?; + } + } + let title = line.path.to_string_lossy(); cw.queue_str(&style, &title)?; if self.in_app && !cw.is_full() { if let ComputationResult::Done(git_status) = &self.tree.git_status { @@ -335,7 +344,7 @@ impl<'s, 't> DisplayableTree<'s, 't> { } #[cfg(unix)] if self.tree.options.show_root_fs { - if let Some(mount) = self.tree.lines[0].mount() { + if let Some(mount) = line.mount() { let fs_space_display = crate::filesystems::MountSpaceDisplay::from( &mount, &self.skin, |