Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
11 changes: 11 additions & 0 deletions cmuxTests/SidebarWorkspaceTableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down