From a8577fbe5c2e5e7ee48383ab6b57b6a119abc1f3 Mon Sep 17 00:00:00 2001 From: l0ng-ai <24760907+l0ng-ai@users.noreply.github.com> Date: Sat, 8 Aug 2026 08:35:50 +0700 Subject: [PATCH] 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. --- src/ui/palette.rs | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/ui/palette.rs b/src/ui/palette.rs index a24f02fe..5b7a9274 100644 --- a/src/ui/palette.rs +++ b/src/ui/palette.rs @@ -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 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