mirror of
https://github.com/sxyazi/yazi.git
synced 2026-07-25 08:41:05 +00:00
..
This commit is contained in:
parent
91a4bd93cc
commit
1b5039fe93
3 changed files with 12 additions and 7 deletions
|
|
@ -22,10 +22,12 @@ impl<'a> Widget for Left<'a> {
|
|||
let secondary = mode.color(&THEME.status.secondary);
|
||||
let body = mode.color(&THEME.status.body);
|
||||
|
||||
let mut spans = vec![];
|
||||
// Separator
|
||||
let separator = &THEME.status.separator;
|
||||
|
||||
// Mode
|
||||
spans.push(Span::styled(&THEME.status.separator.opening, primary.fg()));
|
||||
let mut spans = vec![];
|
||||
spans.push(Span::styled(&separator.opening, primary.fg()));
|
||||
spans.push(Span::styled(
|
||||
format!(" {mode} "),
|
||||
primary.bg().fg(**secondary).add_modifier(Modifier::BOLD),
|
||||
|
|
@ -35,7 +37,7 @@ impl<'a> Widget for Left<'a> {
|
|||
// Length
|
||||
if let Some(len) = h.length {
|
||||
spans.push(Span::styled(format!(" {} ", readable_size(len)), body.bg().fg(**primary)));
|
||||
spans.push(Span::styled(&THEME.status.separator.closing, body.fg()));
|
||||
spans.push(Span::styled(&separator.closing, body.fg()));
|
||||
}
|
||||
|
||||
// Filename
|
||||
|
|
|
|||
|
|
@ -41,13 +41,16 @@ impl<'a> Right<'a> {
|
|||
let secondary = mode.color(&THEME.status.secondary);
|
||||
let body = mode.color(&THEME.status.body);
|
||||
|
||||
// Separator
|
||||
let separator = &THEME.status.separator;
|
||||
|
||||
let cursor = self.cx.manager.current().cursor();
|
||||
let length = self.cx.manager.current().files.len();
|
||||
let percent = if cursor == 0 || length == 0 { 0 } else { (cursor + 1) * 100 / length };
|
||||
|
||||
vec![
|
||||
Span::raw(" "),
|
||||
Span::styled(&THEME.status.separator.opening, body.fg()),
|
||||
Span::styled(&separator.opening, body.fg()),
|
||||
Span::styled(
|
||||
if percent == 0 { " Top ".to_string() } else { format!(" {:>3}% ", percent) },
|
||||
body.bg().fg(**primary),
|
||||
|
|
@ -56,7 +59,7 @@ impl<'a> Right<'a> {
|
|||
format!(" {:>2}/{:<2} ", (cursor + 1).min(length), length),
|
||||
primary.bg().fg(**secondary),
|
||||
),
|
||||
Span::styled(&THEME.status.separator.closing, primary.fg()),
|
||||
Span::styled(&separator.closing, primary.fg()),
|
||||
]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -23,11 +23,11 @@ pub struct Status {
|
|||
pub success: ColorGroup,
|
||||
pub warning: ColorGroup,
|
||||
pub danger: ColorGroup,
|
||||
pub separator: SectionSeparator,
|
||||
pub separator: StatusSeparator,
|
||||
}
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct SectionSeparator {
|
||||
pub struct StatusSeparator {
|
||||
pub opening: String,
|
||||
pub closing: String,
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue