From f6d4a57951603ee19ea317987aeb750fb9a28090 Mon Sep 17 00:00:00 2001 From: Daniel Anderson-Little Date: Wed, 12 Aug 2026 20:25:21 -0400 Subject: [PATCH 1/2] test: cover zero-sized sidebar shortcut hint layout --- cmuxTests/SidebarWorkspaceTableTests.swift | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/cmuxTests/SidebarWorkspaceTableTests.swift b/cmuxTests/SidebarWorkspaceTableTests.swift index c879f2fbb6f..523cbe73585 100644 --- a/cmuxTests/SidebarWorkspaceTableTests.swift +++ b/cmuxTests/SidebarWorkspaceTableTests.swift @@ -50,6 +50,17 @@ struct SidebarWorkspaceTableTests { #expect(!hoverTrackingArea.options.contains(.activeInKeyWindow)) } + @Test + @MainActor + func zeroSizedShortcutHintPillKeepsLabelInsideBounds() throws { + let pill = SidebarShortcutHintPillView() + pill.layout() + let materialView = try #require(pill.subviews.first as? NSVisualEffectView) + let label = try #require(materialView.subviews.first as? NSTextField) + + #expect(label.frame == .zero) + } + @Test func rowHeightEstimateAccountsForScaleWrappingAndDetails() { let calculator = SidebarWorkspaceTableRowHeightCalculator() From 14490ffc385be42bc48c6b6ec8801125eb084aff Mon Sep 17 00:00:00 2001 From: Daniel Anderson-Little Date: Wed, 12 Aug 2026 20:26:47 -0400 Subject: [PATCH 2/2] fix: clamp sidebar shortcut hint layout --- .../AppKitList/Cells/SidebarGroupHeaderRowView.swift | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/Sources/Sidebar/AppKitList/Cells/SidebarGroupHeaderRowView.swift b/Sources/Sidebar/AppKitList/Cells/SidebarGroupHeaderRowView.swift index 554db0a3326..f8a3a0e2821 100644 --- a/Sources/Sidebar/AppKitList/Cells/SidebarGroupHeaderRowView.swift +++ b/Sources/Sidebar/AppKitList/Cells/SidebarGroupHeaderRowView.swift @@ -734,7 +734,11 @@ final class SidebarShortcutHintPillView: NSView { let radius = bounds.height / 2 materialView.frame = bounds materialView.layer?.cornerRadius = radius - label.frame = materialView.bounds.insetBy(dx: Self.horizontalPadding, dy: 2) + let labelBounds = materialView.bounds + label.frame = labelBounds.insetBy( + dx: min(Self.horizontalPadding, labelBounds.width / 2), + dy: min(2, labelBounds.height / 2) + ) layer?.shadowPath = CGPath( roundedRect: bounds, cornerWidth: radius,