Skip to content

Commit

Permalink
mild refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Sebastian Thiel committed Jun 4, 2019
1 parent b7de02e commit 17fe6f8
Showing 1 changed file with 45 additions and 45 deletions.
90 changes: 45 additions & 45 deletions src/interactive/widgets/entries.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,56 +87,56 @@ impl<'a, 'b> Widget for Entries<'a, 'b> {
),
};
let path = path_of(*node_idx);
let segments = vec![
Text::Styled(

let bytes = Text::Styled(
format!(
"{:>byte_column_width$}",
display.byte_format.display(w.size).to_string(), // we would have to impl alignment/padding ourselves otherwise...
byte_column_width = display.byte_format.width()
)
.into(),
Style {
fg: if is_selected {
Color::DarkGray
} else {
Color::Green
},
..style
},
);
let percentage = Text::Styled(
format!(" | {:>5.02}% | ", (w.size as f64 / total as f64) * 100.0,).into(),
style,
);
let name = Text::Styled(
fill_background_to_right(
format!(
"{:>byte_column_width$}",
display.byte_format.display(w.size).to_string(), // we would have to impl alignment/padding ourselves otherwise...
byte_column_width = display.byte_format.width()
)
.into(),
Style {
fg: if is_selected {
Color::DarkGray
"{prefix}{}",
w.name.to_string_lossy(),
prefix = if path.is_dir() && !is_top(*root) {
"/"
} else {
Color::Green
},
..style
},
),
Text::Styled(
format!(" | {:>5.02}% | ", (w.size as f64 / total as f64) * 100.0,).into(),
style,
),
Text::Styled(
fill_background_to_right(
format!(
"{prefix}{}",
w.name.to_string_lossy(),
prefix = if path.is_dir() && !is_top(*root) {
"/"
} else {
" "
}
),
area.width,
)
.into(),
Style {
fg: if path.is_dir() {
" "
}
),
area.width,
)
.into(),
Style {
fg: if path.is_dir() {
style.fg
} else {
if is_selected {
style.fg
} else {
if is_selected {
style.fg
} else {
Color::DarkGray
}
},
..style
Color::DarkGray
}
},
),
];
segments
..style
},
);
let column_segments = vec![bytes, percentage, name];
column_segments
}),
}
.draw(area, buf);
Expand Down

0 comments on commit 17fe6f8

Please sign in to comment.