Skip to content

Commit

Permalink
Merge branch 'master' into patch-1
Browse files Browse the repository at this point in the history
  • Loading branch information
zwpaper authored Jun 22, 2023
2 parents b0d17d4 + bafc495 commit 67ca51a
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 11 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fix obsolete Nerd Font icons from [Han Yeong-woo](https://github.com/nix6839)

### Fixed
- `profile` and `.profile` now share the same icon
- `profile` and `.profile` now share the same icon from [Aaron Lichtman](https://github.com/alichtman)
- Make tox.ini files use the gear/settings icon ([#859](https://github.com/lsd-rs/lsd/pull/859))
- Do not quote filename when piping into another program from [TeamTamoad](https://github.com/TeamTamoad)
- Respect `hidden` flag on Windows [#752](https://github.com/Peltoche/lsd/issues/752)
- Do not show every file are `executable` (green) on Windows
Expand All @@ -28,6 +29,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Handle dereference (-L) with broken symlink from [r3dArch](https://github.com/r3dArch)
- Avoid using Clap's deprecated structs and functions [sudame](https://github.com/sudame)
- Icon theme with overrides from config [sudame](https://github.com/sudame)
- Incorrect colorizing with `--size=bytes` [bells307](https://github.com/bells307)

## [0.23.1] - 2022-09-13

Expand Down
2 changes: 1 addition & 1 deletion CODEOWNERS
Validating CODEOWNERS rules …
Original file line number Diff line number Diff line change
@@ -1 +1 @@
* @meain @Peltoche
* @meain @Peltoche @zwpaper
19 changes: 11 additions & 8 deletions src/meta/size.rs
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,15 @@ impl Size {
ColoredString::new(Colors::default_style(), res)
}

fn paint(&self, colors: &Colors, flags: &Flags, content: String) -> ColoredString {
let unit = self.get_unit(flags);
let elem = match unit {
Unit::Byte | Unit::Kilo => &Elem::FileSmall,
Unit::Mega => &Elem::FileMedium,
_ => &Elem::FileLarge,
fn paint(&self, colors: &Colors, content: String) -> ColoredString {
let bytes = self.get_bytes();

let elem = if bytes >= GB {
&Elem::FileLarge
} else if bytes >= MB {
&Elem::FileMedium
} else {
&Elem::FileSmall
};

colors.colorize(content, elem)
Expand All @@ -100,7 +103,7 @@ impl Size {
pub fn render_value(&self, colors: &Colors, flags: &Flags) -> ColoredString {
let content = self.value_string(flags);

self.paint(colors, flags, content)
self.paint(colors, content)
}

pub fn value_string(&self, flags: &Flags) -> String {
Expand All @@ -118,7 +121,7 @@ impl Size {
pub fn render_unit(&self, colors: &Colors, flags: &Flags) -> ColoredString {
let content = self.unit_string(flags);

self.paint(colors, flags, content)
self.paint(colors, content)
}

pub fn unit_string(&self, flags: &Flags) -> String {
Expand Down
2 changes: 1 addition & 1 deletion src/theme/icon.rs
Original file line number Diff line number Diff line change
Expand Up @@ -280,7 +280,7 @@ impl IconTheme {
("sudoers", "\u{f023}"), // ""
("sxhkdrc", "\u{e615}"), // ""
("tigrc", "\u{e615}"), // ""
("tox.ini", "\u{f0320}"), // "󰌠"
("tox.ini", "\u{e615}"), // ""
(".trash", "\u{f1f8}"), // ""
("ts", "\u{e628}"), // ""
("unlicense", "\u{e60a}"), // ""
Expand Down

0 comments on commit 67ca51a

Please sign in to comment.