Skip to content

Commit

Permalink
Minor style improvements to handle special case
Browse files Browse the repository at this point in the history
  • Loading branch information
Byron committed Jul 22, 2020
1 parent 4f91292 commit 69a2490
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 13 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
12 changes: 6 additions & 6 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -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"
Expand Down
19 changes: 13 additions & 6 deletions src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand All @@ -153,7 +160,7 @@ impl Entries {
Style { fg, ..style }
},
);
vec![bytes, percentage, name]
vec![bytes, left_bar, percentage, right_bar, name]
},
);

Expand Down

0 comments on commit 69a2490

Please sign in to comment.