refactor(ui): use iterator in TileBar loop
Update the loop in TileBar to use an iterator-based approach with enumerate, take, and skip instead of indexing. Co-Authored-By: fiddlerwoaroof/git-smart-commit (gemma-4-31B-it-UD-Q4_K_XL.gguf)
This commit is contained in:
@ -80,11 +80,11 @@ impl<'a> Widget for TileBar<'a> {
|
|||||||
// Check if selected tile is visible when starting from `start`
|
// Check if selected tile is visible when starting from `start`
|
||||||
let mut used: u16 = 0;
|
let mut used: u16 = 0;
|
||||||
let mut sel_visible = false;
|
let mut sel_visible = false;
|
||||||
for i in start..labels.len() {
|
for (i, w) in widths.iter().enumerate().take(labels.len()).skip(start) {
|
||||||
if used + widths[i] > avail {
|
if used + *w > avail {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
used += widths[i];
|
used += *w;
|
||||||
if i == sel {
|
if i == sel {
|
||||||
sel_visible = true;
|
sel_visible = true;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user