fix: centralize chrome segment spacing

This commit is contained in:
2026-10-18 01:52:43 +02:00
parent d8cfd27ee6
commit a28444a9f2
5 changed files with 87 additions and 75 deletions
+5 -3
View File
@@ -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;
}