fix: centralize chrome segment spacing
This commit is contained in:
+5
-3
@@ -1833,7 +1833,7 @@ fn chrome_items<'a>(
|
||||
}
|
||||
|
||||
fn chrome_group_width(items: &[ChromeItem<'_>]) -> usize {
|
||||
items.iter().map(|item| item.width).sum()
|
||||
items.iter().map(|item| item.width).sum::<usize>() + items.len().saturating_sub(1)
|
||||
}
|
||||
|
||||
fn chrome_fits([left, center, right]: [usize; 3], width: usize) -> bool {
|
||||
@@ -1904,13 +1904,15 @@ fn draw_chrome(frame: &mut Frame, mut groups: [Vec<ChromeItem<'_>>; 3], area: Re
|
||||
}
|
||||
break;
|
||||
};
|
||||
widths[group] -= groups[group].remove(index).width;
|
||||
groups[group].remove(index);
|
||||
widths[group] = chrome_group_width(&groups[group]);
|
||||
}
|
||||
let widths = widths.map(|cells| cells.min(width));
|
||||
let starts = [0, (width - widths[1]) / 2, width - widths[2]];
|
||||
for (items, start) in groups.iter().zip(starts) {
|
||||
let mut x = start;
|
||||
for item in items {
|
||||
for (index, item) in items.iter().enumerate() {
|
||||
x += usize::from(index > 0);
|
||||
if x >= width {
|
||||
break;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user