Skip to content

Commit

Permalink
Fix go to latest bug
Browse files Browse the repository at this point in the history
  • Loading branch information
sachaos committed Sep 5, 2024
1 parent d525f1e commit d1e19cb
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/components/history.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,16 @@ impl History {
}

fn select_latest(&mut self) -> Result<()> {
for (i, item) in self.items.iter().enumerate() {
let index_to_select = self.items.iter().enumerate().find_map(|(i, item)| {
let item = item.borrow();
if !item.is_running {
self.state.select(Some(i));
return Ok(());
Some(i)
} else {
None
}
}
});

Ok(())
self.select(index_to_select)
}

fn select(&mut self, index: Option<usize>) -> Result<()> {
Expand Down

0 comments on commit d1e19cb

Please sign in to comment.