summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSebastian Thiel <sebastian.thiel@icloud.com>2020-07-22 13:50:31 +0800
committerSebastian Thiel <sebastian.thiel@icloud.com>2020-07-22 13:52:49 +0800
commit69a2490844d87c09cd5cc51da49e3cd87a03c35a (patch)
tree0bcdf01c3dfe609b31e937b3c7ffb3e08dd18f97
parent4f912929f213c00f6721995bfc5ee0b8879d80e9 (diff)
Minor style improvements to handle special case
-rw-r--r--CHANGELOG.md4
-rw-r--r--Cargo.lock12
-rw-r--r--Cargo.toml2
-rw-r--r--src/interactive/widgets/entries.rs19
4 files changed, 24 insertions, 13 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 7c3a113..bebb941 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,3 +1,7 @@
+#### v2.10.0 - Minor improvements of looks; improved windows support
+
+* previously in interactive mode on Windows, directory sizes would appear as 0 bytes in size. This is now fixed!
+
#### v2.9.1 - Globs for Windows; fixed handling of colors
* On widnows, `dua` will now expand glob patterns by itself as this capability is not implemented by shells `dua` can now run in.
diff --git a/Cargo.lock b/Cargo.lock
index 56cbd65..a336986 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -206,7 +206,7 @@ dependencies = [
"crossterm",
"termion",
"tui",
- "tui-react 0.10.0",
+ "tui-react 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -227,7 +227,7 @@ checksum = "524cbf6897b527295dff137cec09ecf3a05f4fddffd7dfcd1585403449e74198"
[[package]]
name = "dua-cli"
-version = "2.9.1"
+version = "2.10.0"
dependencies = [
"anyhow",
"atty",
@@ -243,7 +243,7 @@ dependencies = [
"pretty_assertions",
"structopt",
"tui",
- "tui-react 0.10.0",
+ "tui-react 0.10.1 (registry+https://github.com/rust-lang/crates.io-index)",
"unicode-segmentation",
"wild",
]
@@ -707,9 +707,7 @@ dependencies = [
[[package]]
name = "tui-react"
-version = "0.10.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-checksum = "21bbc5221de660fa2cc79a5386d72f268174a90e37eef004f5210cc7f94baf78"
+version = "0.10.1"
dependencies = [
"log",
"tui",
@@ -720,6 +718,8 @@ dependencies = [
[[package]]
name = "tui-react"
version = "0.10.1"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+checksum = "a97bea172550957047351f406690772b6fa6244c20b95cbb230228bbb7477c61"
dependencies = [
"log",
"tui",
diff --git a/Cargo.toml b/Cargo.toml
index f1a3b7e..712a07a 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,6 +1,6 @@
[package]
name = "dua-cli"
-version = "2.9.1"
+version = "2.10.0"
authors = ["Sebastian Thiel <byronimo@gmail.com>"]
edition = "2018"
repository = "https://github.com/Byron/dua-cli"
diff --git a/src/interactive/widgets/entries.rs b/src/interactive/widgets/entries.rs
index 62d24e3..1d947cf 100644
--- a/src/interactive/widgets/entries.rs
+++ b/src/interactive/widgets/entries.rs
@@ -125,13 +125,20 @@ impl Entries {
..style
},
);
+ let fraction = w.size as f32 / total as f32;
+ let should_avoid_showing_a_big_reversed_bar = fraction > 0.9;
+ let local_style = if should_avoid_showing_a_big_reversed_bar {
+ style.remove_modifier(Modifier::REVERSED)
+ } else {
+ style
+ };
+
+ let left_bar = Span::styled(" |", local_style);
let percentage = Span::styled(
- format!(
- " |{}| ",
- display.byte_vis.display(w.size as f32 / total as f32)
- ),
- style,
+ format!("{}", display.byte_vis.display(fraction)),
+ local_style,
);
+ let right_bar = Span::styled("| ", local_style);
let name = Span::styled(
fill_background_to_right(
@@ -153,7 +160,7 @@ impl Entries {
Style { fg, ..style }
},
);
- vec![bytes, percentage, name]
+ vec![bytes, left_bar, percentage, right_bar, name]
},
);