summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPiotr Wach <pwach@bloomberg.net>2023-12-12 23:21:21 +0000
committerSebastian Thiel <sebastian.thiel@icloud.com>2023-12-13 09:13:12 +0100
commit101a37761952f094a782fb34850c82070565125b (patch)
treedb5a329d634a31f2f4d3f5b64332fca09450e129
parentf23a57fa9c16276525c315c875729c9ef9920fdf (diff)
Adds the missing '/' prefix for root directories
-rw-r--r--src/interactive/widgets/entries.rs19
1 files changed, 2 insertions, 17 deletions
diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs
index e50a0a1..538eace 100644
--- a/src/interactive/widgets/entries.rs
+++ b/src/interactive/widgets/entries.rs
@@ -60,12 +60,6 @@ impl Entries {
} = props.borrow();
let list = &mut self.list;
- let is_top = |node_idx| {
- tree.neighbors_directed(node_idx, petgraph::Incoming)
- .next()
- .is_none()
- };
-
let total: u128 = entries.iter().map(|b| b.data.size).sum();
let (item_count, item_size): (u64, u128) = entries
.iter()
@@ -115,8 +109,6 @@ impl Entries {
columns.push(name_column(
&entry_data.name,
*is_dir,
- is_top,
- *root,
area,
name_style(is_marked, *exists, *is_dir, text_style),
));
@@ -265,20 +257,13 @@ fn count_column(entry_count: Option<u64>, style: Style) -> Span<'static> {
)
}
-fn name_column(
- entry_name: &Path,
- is_dir: bool,
- is_top: impl Fn(petgraph::stable_graph::NodeIndex) -> bool,
- root: petgraph::stable_graph::NodeIndex,
- area: Rect,
- style: Style,
-) -> Span<'static> {
+fn name_column(entry_name: &Path, is_dir: bool, area: Rect, style: Style) -> Span<'static> {
Span::styled(
fill_background_to_right(
format!(
"{prefix}{}",
entry_name.to_string_lossy(),
- prefix = if is_dir && !is_top(root) { "/" } else { " " }
+ prefix = if is_dir { "/" } else { " " }
),
area.width,
),