Skip to content

Commit

Permalink
fix: display 0 indicator if list is empty
Browse files Browse the repository at this point in the history
  • Loading branch information
aidanaden committed Jun 21, 2024
1 parent 1cb8b7c commit 25596f0
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions rm-main/src/ui/tabs/torrents/bottom_stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -50,9 +50,15 @@ impl Component for BottomStats {
let table_manager = &*self.table_manager.lock().unwrap();
let table = table_manager.table.borrow();
let all = table.get_len();

if let Some(current) = table.state.borrow().selected() {
let current_idx = current + 1;
text = format!(" {current_idx}/{all} | {text}");
if all > 0 {
let current_idx = current + 1;
text = format!(" {current_idx}/{all} | {text}");
} else {
// dont display index if no items in table
text = format!(" {all} | {text}");
}
} else {
text = format!(" {all} | {text}");
}
Expand Down

0 comments on commit 25596f0

Please sign in to comment.