Skip to content

Commit

Permalink
Fix minor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sile committed Oct 19, 2023
1 parent e878509 commit 65a103f
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions src/ui.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ impl App {
}

pub fn run(mut self) -> anyhow::Result<()> {
self.render_replay_ui()?;
self.render_replay_ui_if_need()?;
loop {
if self.handle_event()? {
break;
Expand Down Expand Up @@ -127,14 +127,14 @@ impl App {
self.replay_cursor_time = self
.replay_cursor_time
.saturating_sub(Duration::from_secs(1));
self.render_replay_ui()?;
self.render_replay_ui_if_need()?;
}
KeyCode::Char('l') => {
if (self.replay_cursor_time + Duration::from_secs(1))
< self.poller.replay_last_time()
{
self.replay_cursor_time = self.replay_cursor_time + Duration::from_secs(1);
self.render_replay_ui()?;
self.render_replay_ui_if_need()?;
}
}
KeyCode::Left => {
Expand Down Expand Up @@ -178,7 +178,11 @@ impl App {
Ok(())
}

fn render_replay_ui(&mut self) -> anyhow::Result<()> {
fn render_replay_ui_if_need(&mut self) -> anyhow::Result<()> {
if !self.ui.replay_mode {
return Ok(());
}

let time = self.replay_cursor_time;

self.ui.history.clear();
Expand Down

0 comments on commit 65a103f

Please sign in to comment.