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 secondary = mode.color(&THEME.status.secondary);
|
||||||
let body = mode.color(&THEME.status.body);
|
let body = mode.color(&THEME.status.body);
|
||||||
|
|
||||||
let mut spans = vec![];
|
// Separator
|
||||||
|
let separator = &THEME.status.separator;
|
||||||
|
|
||||||
// Mode
|
// 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(
|
spans.push(Span::styled(
|
||||||
format!(" {mode} "),
|
format!(" {mode} "),
|
||||||
primary.bg().fg(**secondary).add_modifier(Modifier::BOLD),
|
primary.bg().fg(**secondary).add_modifier(Modifier::BOLD),
|
||||||
|
|
@ -35,7 +37,7 @@ impl<'a> Widget for Left<'a> {
|
||||||
// Length
|
// Length
|
||||||
if let Some(len) = h.length {
|
if let Some(len) = h.length {
|
||||||
spans.push(Span::styled(format!(" {} ", readable_size(len)), body.bg().fg(**primary)));
|
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
|
// Filename
|
||||||
|
|
|
||||||
|
|
@ -41,13 +41,16 @@ impl<'a> Right<'a> {
|
||||||
let secondary = mode.color(&THEME.status.secondary);
|
let secondary = mode.color(&THEME.status.secondary);
|
||||||
let body = mode.color(&THEME.status.body);
|
let body = mode.color(&THEME.status.body);
|
||||||
|
|
||||||
|
// Separator
|
||||||
|
let separator = &THEME.status.separator;
|
||||||
|
|
||||||
let cursor = self.cx.manager.current().cursor();
|
let cursor = self.cx.manager.current().cursor();
|
||||||
let length = self.cx.manager.current().files.len();
|
let length = self.cx.manager.current().files.len();
|
||||||
let percent = if cursor == 0 || length == 0 { 0 } else { (cursor + 1) * 100 / length };
|
let percent = if cursor == 0 || length == 0 { 0 } else { (cursor + 1) * 100 / length };
|
||||||
|
|
||||||
vec![
|
vec![
|
||||||
Span::raw(" "),
|
Span::raw(" "),
|
||||||
Span::styled(&THEME.status.separator.opening, body.fg()),
|
Span::styled(&separator.opening, body.fg()),
|
||||||
Span::styled(
|
Span::styled(
|
||||||
if percent == 0 { " Top ".to_string() } else { format!(" {:>3}% ", percent) },
|
if percent == 0 { " Top ".to_string() } else { format!(" {:>3}% ", percent) },
|
||||||
body.bg().fg(**primary),
|
body.bg().fg(**primary),
|
||||||
|
|
@ -56,7 +59,7 @@ impl<'a> Right<'a> {
|
||||||
format!(" {:>2}/{:<2} ", (cursor + 1).min(length), length),
|
format!(" {:>2}/{:<2} ", (cursor + 1).min(length), length),
|
||||||
primary.bg().fg(**secondary),
|
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 success: ColorGroup,
|
||||||
pub warning: ColorGroup,
|
pub warning: ColorGroup,
|
||||||
pub danger: ColorGroup,
|
pub danger: ColorGroup,
|
||||||
pub separator: SectionSeparator,
|
pub separator: StatusSeparator,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Deserialize)]
|
#[derive(Deserialize)]
|
||||||
pub struct SectionSeparator {
|
pub struct StatusSeparator {
|
||||||
pub opening: String,
|
pub opening: String,
|
||||||
pub closing: String,
|
pub closing: String,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue