summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCanop <cano.petrole@gmail.com>2019-01-11 11:05:42 +0100
committerCanop <cano.petrole@gmail.com>2019-01-11 11:05:42 +0100
commit102c2c77c2264bf8bf44d2806c753d7adfe8c5b1 (patch)
tree63470b5072236853ff60a5a527ba7bb6fd322396
parent198507f7649b01357fad57b5da624ae1506fbecc (diff)
fix first level too much trimmed when sizes displayed
-rw-r--r--README.md2
-rw-r--r--src/file_sizes.rs3
-rw-r--r--src/tree_build.rs6
3 files changed, 7 insertions, 4 deletions
diff --git a/README.md b/README.md
index 023d589..6e3503f 100644
--- a/README.md
+++ b/README.md
@@ -115,6 +115,6 @@ or
BROOT_LOG=info cargo run
-If you want to discuss the code or features of broot, please come to [our chat](https://miaou.dystroy.org/3?Code_et_Croissants). Before to start coding for a PR, it would really be a good idea to come and speak about it.
+If you want to discuss the code or features of broot, please come to [our chat](https://miaou.dystroy.org/3?Code_et_Croissants). Before to start coding for a PR, it would really be a good idea to come and talk about it.
If you'd like a new feature, don't hesitate to ask for it.
diff --git a/src/file_sizes.rs b/src/file_sizes.rs
index e876d67..5440c29 100644
--- a/src/file_sizes.rs
+++ b/src/file_sizes.rs
@@ -44,9 +44,8 @@ impl Size {
for e in entries {
if let Ok(e) = e {
if let Ok(md) = e.metadata() {
- let p = e.path();
if md.is_dir() {
- dirs.push(p);
+ dirs.push(e.path());
} else if md.nlink() > 1 {
if !inodes.insert(md.ino()) {
// it was already in the set
diff --git a/src/tree_build.rs b/src/tree_build.rs
index 979ff5a..005acc0 100644
--- a/src/tree_build.rs
+++ b/src/tree_build.rs
@@ -407,7 +407,11 @@ impl TreeBuilder {
let mut remove_queue: BinaryHeap<SortableBLineIdx> = BinaryHeap::new();
for idx in out_blines[1..].iter() {
let bline = &self.blines[*idx];
- if bline.has_match && bline.nb_kept_children == 0 {
+ if
+ bline.has_match
+ && bline.nb_kept_children == 0
+ && (bline.depth>1 || !self.options.show_sizes) // we keep the complete first level when showing sizes
+ {
remove_queue.push(SortableBLineIdx {
idx: *idx,
score: bline.score,