generated from PlexSheep/rs-base
add mode show and fix some things #20
|
@ -150,18 +150,20 @@ pub fn timebarw_label<'a>(
|
||||||
.unwrap(),
|
.unwrap(),
|
||||||
),
|
),
|
||||||
};
|
};
|
||||||
let until = last_reset
|
let until = {
|
||||||
// BUG: seconds are sometimes a little too much, for
|
// we need to cut off the seconds if we're not in custom and countup mode, otherwise,
|
||||||
// example with `-o` #17
|
// the timestamp will not be correct. This fixes #17
|
||||||
.checked_add_signed(len.into())
|
match len {
|
||||||
.expect("could not calculate when the countdown finishes");
|
TimeBarLength::Custom(_) | TimeBarLength::Countup(_) => last_reset,
|
||||||
let timestamp_until: String = format!(
|
_ => last_reset.with_second(0).unwrap(),
|
||||||
"{:02}:{:02}:{:02}",
|
}
|
||||||
until.hour(),
|
}
|
||||||
until.minute(),
|
// BUG: seconds are sometimes a little too much, for
|
||||||
until.second()
|
// example with `-o` #17
|
||||||
);
|
.checked_add_signed(len.into())
|
||||||
Paragraph::new(format!("{time_now} / {len} ({timestamp_until})"))
|
.expect("could not calculate when the countdown finishes")
|
||||||
|
.format("%H:%M:%S");
|
||||||
|
Paragraph::new(format!("{time_now} / {len} ({until})"))
|
||||||
.alignment(Alignment::Center)
|
.alignment(Alignment::Center)
|
||||||
.block(
|
.block(
|
||||||
Block::default().padding(Padding::right(if inner_rect.width > 80 {
|
Block::default().padding(Padding::right(if inner_rect.width > 80 {
|
||||||
|
|
Reference in New Issue