Skip to content
Merged
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
16 changes: 15 additions & 1 deletion Clipy/Sources/Managers/MenuManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3288,6 +3288,17 @@ final class BoardManHistoryCellView: NSTableCellView {
))
}

static func synchronizedCellFrame(existingFrame: NSRect, safeWidth: CGFloat) -> NSRect {
let maximumOriginX = max(0, floor(safeWidth) - 1)
let preservedOriginX = min(max(0, floor(existingFrame.minX)), maximumOriginX)
return NSIntegralRect(NSRect(
x: preservedOriginX,
y: existingFrame.minY,
width: max(1, floor(safeWidth) - preservedOriginX),
height: existingFrame.height
))
}

override func layout() {
super.layout()
let horizontalInset: CGFloat = 10
Expand Down Expand Up @@ -6480,7 +6491,10 @@ class BoardManPanel: NSPanel {
rowView.needsDisplay = true

if let cellView = rowView.view(atColumn: 0) as? NSView {
cellView.frame = NSRect(x: 0, y: cellView.frame.origin.y, width: safeWidth, height: cellView.frame.height)
cellView.frame = BoardManHistoryCellView.synchronizedCellFrame(
existingFrame: cellView.frame,
safeWidth: safeWidth
)
cellView.needsLayout = true
cellView.needsDisplay = true
}
Expand Down
9 changes: 9 additions & 0 deletions ClipyTests/EntitlementGateTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1088,6 +1088,15 @@ final class BoardManInteractionRuleTests {
"Only the center title may compress between fixed accessories.")
#expect((narrowPrimary.font?.pointSize ?? 99) <= 12.75,
"Narrow rows should use the compact title font instead of squeezing accessories.")

let resizedCellFrame = BoardManHistoryCellView.synchronizedCellFrame(
existingFrame: NSRect(x: 14, y: 0, width: 746, height: 46),
safeWidth: 600
)
#expect(resizedCellFrame.minX == 14,
"Responsive resizing must preserve the native table-cell leading inset.")
#expect(resizedCellFrame.maxX == 600,
"Responsive resizing must fill the remaining width without removing the leading inset.")
}

@Test
Expand Down
Loading