summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sthiel@thoughtworks.com>2019-06-16 12:17:35 +0800
committerSebastian Thiel <sthiel@thoughtworks.com>2019-06-16 12:17:35 +0800
commitd9dcbd0f89c1267f272f3cd7e9f9dd69d0ae145b (patch)
tree2e367e52c907c60c789de30abc063539355497ad
parent81dc53b0e6d7c292909610fba6fd030ed6b01917 (diff)
performance improvementsv2.1.2
-rw-r--r--Cargo.toml2
-rw-r--r--README.md9
-rw-r--r--src/interactive/app/common.rs5
-rw-r--r--src/interactive/app/eventloop.rs3
-rw-r--r--src/interactive/app/handlers.rs2
-rw-r--r--src/interactive/widgets/entries.rs10
6 files changed, 21 insertions, 10 deletions
diff --git a/Cargo.toml b/Cargo.toml
index 6bccca1..3ac4e5a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "dua-cli"
-version = "2.1.1"
+version = "2.1.2"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
edition = "2018"
include = ["src/**/*", "Cargo.toml"]
diff --git a/README.md b/README.md
index c42a072..cf6a441 100644
--- a/README.md
+++ b/README.md
@@ -42,8 +42,13 @@ dua interactive
##### Other Features
* [ ] Evaluate unit coloring - can we highlight different units better, make them stick out?
+
+#### ✅ v2.1.2 bug fixes and improvements
-#### ✅ v2.1.01 bug fixes and improvements
+* Performance fix when showing folders with large amounts of files
+* Display of amount of entries per directory
+
+#### ✅ v2.1.1 bug fixes and improvements
* Better information about deletion progress
* removal of windows support
@@ -97,8 +102,6 @@ Thanks to [jwalk][jwalk], all there was left to do is to write a command-line in
### Limitations
-* When interactively displaying directories with a large number of entries, there may be a noticeable slowdown as we probe each entry's meta-data
- once per draw request.
* _logical filesize_ is used instead of computed or estimating actual size on disk.
* _easy fix_: file names in main window are not truncated if too large. They are cut off on the right.
* There are plenty of examples in `tests/fixtures` which don't render correctly in interactive mode.
diff --git a/src/interactive/app/common.rs b/src/interactive/app/common.rs
index c612f28..6338f25 100644
--- a/src/interactive/app/common.rs
+++ b/src/interactive/app/common.rs
@@ -39,11 +39,12 @@ pub fn sorted_entries(tree: &Tree, node_idx: TreeIndex, sorting: SortMode) -> Ve
.filter_map(|idx| {
tree.node_weight(idx).map(|w| {
let p = path_of(tree, idx);
+ let pm = p.metadata();
EntryDataBundle {
index: idx,
data: w.clone(),
- is_dir: p.is_dir(),
- exists: p.exists(),
+ exists: pm.is_ok(),
+ is_dir: pm.ok().map_or(false, |m| m.is_dir()),
}
})
})
diff --git a/src/interactive/app/eventloop.rs b/src/interactive/app/eventloop.rs
index a85ad1e..38533a2 100644
--- a/src/interactive/app/eventloop.rs
+++ b/src/interactive/app/eventloop.rs
@@ -8,8 +8,7 @@ use dua::{
WalkOptions, WalkResult,
};
use failure::Error;
-use std::collections::BTreeMap;
-use std::{io, path::PathBuf};
+use std::{collections::BTreeMap, io, path::PathBuf};
use termion::event::Key;
use tui::backend::Backend;
use tui_react::Terminal;
diff --git a/src/interactive/app/handlers.rs b/src/interactive/app/handlers.rs
index 976a53b..0d6aa4e 100644
--- a/src/interactive/app/handlers.rs
+++ b/src/interactive/app/handlers.rs
@@ -134,7 +134,7 @@ impl TerminalApp {
}
pub fn change_entry_selection(&mut self, direction: CursorDirection) {
- let entries = sorted_entries(&self.traversal.tree, self.state.root, self.state.sorting);
+ let entries = &self.state.entries;
let next_selected_pos = match self.state.selected {
Some(ref selected) => entries
.iter()
diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs
index 006673c..ed2c001 100644
--- a/src/interactive/widgets/entries.rs
+++ b/src/interactive/widgets/entries.rs
@@ -65,7 +65,15 @@ impl Entries {
.unwrap_or_else(|_| String::from(".")),
p => p,
};
- let title = format!(" {} ", title);
+ let title = format!(
+ " {} ({} item{})",
+ title,
+ entries.len(),
+ match entries.len() {
+ 1 => "",
+ _ => "s",
+ }
+ );
let block = Block::default()
.title(&title)
.border_style(*border_style)