Skip to content

Commit

Permalink
The first display of paths to be deleted!
Browse files Browse the repository at this point in the history
Still no way to show that one is contained in others... probably not
needed right now... .
  • Loading branch information
Sebastian Thiel committed Jun 6, 2019
1 parent f54a5aa commit b79b1ae
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 7 deletions.
1 change: 1 addition & 0 deletions src/interactive/app/eventloop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ impl Default for FocussedPane {
pub type EntryMarkMap = BTreeMap<TreeIndex, EntryMark>;
pub struct EntryMark {
pub size: u64,
pub path: PathBuf,
}

#[derive(Default)]
Expand Down
10 changes: 7 additions & 3 deletions src/interactive/app/handlers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -136,9 +136,13 @@ impl TerminalApp {
self.state.marked.remove(&index);
} else {
if let Some(e) = self.state.entries.iter().find(|e| e.index == index) {
self.state
.marked
.insert(index, EntryMark { size: e.data.size });
self.state.marked.insert(
index,
EntryMark {
size: e.data.size,
path: path_of(&self.traversal.tree, index),
},
);
}
}
if self.state.marked.is_empty() {
Expand Down
3 changes: 1 addition & 2 deletions src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,8 +166,7 @@ impl Entries {
..style
},
);
let column_segments = vec![bytes, percentage, name];
column_segments
vec![bytes, percentage, name]
},
);

Expand Down
18 changes: 16 additions & 2 deletions src/interactive/widgets/mark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ use crate::interactive::EntryMarkMap;
use dua::traverse::TreeIndex;
use itertools::Itertools;
use std::borrow::Borrow;
use tui::{buffer::Buffer, layout::Rect, style::Style, widgets::Block, widgets::Borders};
use tui::{
buffer::Buffer, layout::Rect, style::Color, style::Style, widgets::Block, widgets::Borders,
widgets::Text,
};
use tui_react::{List, ListProps};

#[derive(Default)]
Expand Down Expand Up @@ -41,10 +44,21 @@ impl MarkPane {
.map(|(pos, _)| pos)
});

let entries = marked.iter().map(|(_, v)| {
let name = Text::Styled(
v.path.to_string_lossy(),
Style {
fg: Color::LightRed,
..Style::default()
},
);
vec![name]
});

let props = ListProps {
block: Some(block),
entry_in_view,
};
self.list.render(props, vec![], area, buf)
self.list.render(props, entries, area, buf)
}
}

0 comments on commit b79b1ae

Please sign in to comment.