fix(palette): line section headers up with the rows they head

A section header carried px(11) while a row is a ListItem inset by mx(5)
whose own padding is px_3, so every label under a header started 6px to
its right. Give the header the sum, from named constants so the two
cannot drift apart again.
This commit is contained in:
l0ng-ai
2026-08-08 08:35:50 +07:00
parent 4275bb1aef
commit a8577fbe5c
+9 -2
View File
@@ -819,7 +819,7 @@ impl ListDelegate for PaletteDelegate {
Some(
h_flex()
.h(px(PALETTE_ROW_H))
.px(px(11.))
.px(px(PALETTE_LABEL_INSET))
.items_center()
.text_xs()
.text_color(cx.theme().muted_foreground)
@@ -910,7 +910,7 @@ impl ListDelegate for PaletteDelegate {
ListItem::new(("palette-row", ix.section * 1000 + ix.row))
.selected(Some(ix) == self.selected)
.h(px(PALETTE_ROW_H))
.mx(px(5.))
.mx(px(PALETTE_ROW_MX))
.rounded(px(6.))
.text_sm()
.child(row),
@@ -1074,6 +1074,13 @@ impl EventEmitter<PaletteEvent> for PaletteView {}
const PALETTE_ROW_H: f32 = 30.;
/// Left inset of a row's *label*, so a section header can start on the same
/// pixel column as the rows it introduces. A row is a `ListItem` inset by
/// `PALETTE_ROW_MX` whose own padding is `px_3`; a header has neither, so it
/// has to carry the sum itself.
const PALETTE_ROW_MX: f32 = 5.;
const PALETTE_LABEL_INSET: f32 = PALETTE_ROW_MX + 12.;
/// The chord that opens the selected row for editing instead of running it.
///
/// It cannot be `→`: gpui-component's `Input` binds bare `right` to MoveRight