show mode of timebar with extra info #18

Merged
cscherrNT merged 10 commits from feat/mode-show into devel 2024-07-19 10:06:09 +02:00
3 changed files with 4 additions and 4 deletions
Showing only changes of commit 290704de46 - Show all commits

View File

@ -11,7 +11,7 @@ use ratatui::backend::CrosstermBackend;
use ratatui::crossterm::event::{self, poll, Event, KeyCode, KeyModifiers}; use ratatui::crossterm::event::{self, poll, Event, KeyCode, KeyModifiers};
use ratatui::layout::{Alignment, Constraint, Direction, Layout, Rect}; use ratatui::layout::{Alignment, Constraint, Direction, Layout, Rect};
use ratatui::style::{Style, Stylize}; use ratatui::style::{Style, Stylize};
use ratatui::widgets::{Block, LineGauge, Padding, Paragraph}; use ratatui::widgets::{Block, Padding, Paragraph};
use ratatui::Terminal; use ratatui::Terminal;
use std::collections::HashMap; use std::collections::HashMap;
use std::io::{Cursor, Stdout, Write}; use std::io::{Cursor, Stdout, Write};
@ -111,7 +111,7 @@ impl Clock {
} }
TimeBarLength::Custom(_) => { TimeBarLength::Custom(_) => {
if since_last_reset.num_seconds() >= 1 if since_last_reset.num_seconds() >= 1
&& i64::from(since_last_reset.num_seconds()) >= len.as_secs() && since_last_reset.num_seconds() >= len.as_secs()
{ {
self.last_reset = Some(Local::now()); self.last_reset = Some(Local::now());
} }

View File

@ -1,6 +1,6 @@
use std::fmt::Display; use std::fmt::Display;
use chrono::{Duration, TimeDelta}; use chrono::Duration;
#[derive(Debug, Clone, Copy, PartialEq, Eq)] #[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum TimeBarLength { pub enum TimeBarLength {

View File

@ -150,7 +150,7 @@ pub fn timebarw_label<'a>(
.unwrap(), .unwrap(),
), ),
}; };
Paragraph::new(format!("{} / {}", time_now, len)) Paragraph::new(format!("{time_now} / {len}"))
.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 {