diff options
author | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-07 07:39:01 +0530 |
---|---|---|
committer | Sebastian Thiel <sthiel@thoughtworks.com> | 2019-06-07 07:39:01 +0530 |
commit | 6cb2d92aa41e179242bb926b965862d90f06df82 (patch) | |
tree | 0db83e1678a3ed7290a5477c3eccee9d989832c7 /src/interactive/widgets/mark.rs | |
parent | 8d21dbb3a44aeaf3989c25d9555559b34632f8c7 (diff) |
moved marked information from footer to title of mark pane
Diffstat (limited to 'src/interactive/widgets/mark.rs')
-rw-r--r-- | src/interactive/widgets/mark.rs | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/interactive/widgets/mark.rs b/src/interactive/widgets/mark.rs index 7d50991..9f94592 100644 --- a/src/interactive/widgets/mark.rs +++ b/src/interactive/widgets/mark.rs @@ -1,6 +1,6 @@ use crate::interactive::{widgets::COLOR_MARKED_LIGHT, CursorDirection, EntryMark, EntryMarkMap}; -use dua::path_of; use dua::traverse::{Tree, TreeIndex}; +use dua::{path_of, ByteFormat}; use itertools::Itertools; use std::borrow::Borrow; use termion::{event::Key, event::Key::*}; @@ -24,6 +24,7 @@ pub struct MarkPane { pub struct MarkPaneProps { pub border_style: Style, + pub format: ByteFormat, } impl MarkPane { @@ -90,10 +91,17 @@ impl MarkPane { } pub fn render(&mut self, props: impl Borrow<MarkPaneProps>, area: Rect, buf: &mut Buffer) { - let MarkPaneProps { border_style } = props.borrow(); + let MarkPaneProps { + border_style, + format, + } = props.borrow(); let marked: &_ = &self.marked; - let title = format!("Marked Entries: {}", marked.len()); + let title = format!( + "Marked {} items ({}) ", + marked.len(), + format.display(marked.iter().map(|(_k, v)| v.size).sum::<u64>()) + ); let block = Block::default() .title(&title) .border_style(*border_style) |