From 0d3956cf4dd7d834e99aa9cd6dfbf9c696c3b0f9 Mon Sep 17 00:00:00 2001 From: uniplanck <198168437+uniplanck@users.noreply.github.com> Date: Fri, 31 Jul 2026 14:15:14 +0900 Subject: [PATCH] fix: rebalance snippet editor status spacing --- Clipy/Sources/Managers/MenuManager.swift | 43 +++++++++++++++++------- ClipyTests/EntitlementGateTests.swift | 8 ++--- 2 files changed, 34 insertions(+), 17 deletions(-) diff --git a/Clipy/Sources/Managers/MenuManager.swift b/Clipy/Sources/Managers/MenuManager.swift index b37a16b..92d710e 100644 --- a/Clipy/Sources/Managers/MenuManager.swift +++ b/Clipy/Sources/Managers/MenuManager.swift @@ -6340,48 +6340,65 @@ class BoardManPanel: NSPanel { let contentWidth = max(120, width - (inset * 2)) let topY = height - inset + let titleLabelHeight: CGFloat = 17 + let titleFieldHeight = LayoutMetrics.controlHeight + let titleLabelToFieldGap: CGFloat = 4 + let titleFieldToStatusGap: CGFloat = 24 + let statusHeight: CGFloat = 32 + let statusToToggleGap: CGFloat = 14 + let toggleHeight: CGFloat = 22 + let toggleToContentLabelGap: CGFloat = 16 + let contentLabelHeight: CGFloat = 17 + let contentLabelToEditorGap: CGFloat = 10 + + let titleLabelY = topY - titleLabelHeight + let titleFieldY = titleLabelY - titleLabelToFieldGap - titleFieldHeight + let statusY = titleFieldY - titleFieldToStatusGap - statusHeight + let toggleY = statusY - statusToToggleGap - toggleHeight + let contentLabelY = toggleY - toggleToContentLabelGap - contentLabelHeight + let contentTop = contentLabelY - contentLabelToEditorGap + snippetEditorTitleLabel?.frame = NSIntegralRect(NSRect( x: inset, - y: topY - 17, + y: titleLabelY, width: contentWidth, - height: 17 + height: titleLabelHeight )) snippetEditorTitleField?.frame = NSIntegralRect(NSRect( x: inset, - y: topY - 53, + y: titleFieldY, width: contentWidth, - height: LayoutMetrics.controlHeight + height: titleFieldHeight )) snippetEditorStatusLabel?.frame = NSIntegralRect(NSRect( x: inset, - y: topY - 101, + y: statusY, width: contentWidth, - height: 32 + height: statusHeight )) let toggleGap: CGFloat = 8 let toggleWidth = max(104, floor((contentWidth - toggleGap) / 2)) snippetFolderEnableButton?.frame = NSIntegralRect(NSRect( x: inset, - y: topY - 133, + y: toggleY, width: toggleWidth, - height: 22 + height: toggleHeight )) snippetEnableButton?.frame = NSIntegralRect(NSRect( x: inset + toggleWidth + toggleGap, - y: topY - 133, + y: toggleY, width: toggleWidth, - height: 22 + height: toggleHeight )) snippetEditorContentLabel?.frame = NSIntegralRect(NSRect( x: inset, - y: topY - 166, + y: contentLabelY, width: contentWidth, - height: 17 + height: contentLabelHeight )) let contentBottom = inset + LayoutMetrics.actionButtonHeight + 14 - let contentTop = topY - 176 let contentHeight = max(90, contentTop - contentBottom) snippetEditorScrollView?.frame = NSIntegralRect(NSRect( x: inset, diff --git a/ClipyTests/EntitlementGateTests.swift b/ClipyTests/EntitlementGateTests.swift index ae8f39c..76f5e0c 100644 --- a/ClipyTests/EntitlementGateTests.swift +++ b/ClipyTests/EntitlementGateTests.swift @@ -1218,10 +1218,10 @@ final class BoardManPanelLayoutTests { #expect((titleField?.frame.width ?? 0) >= 250, "Snippet title editor is still cramped.") if let titleField, let statusLabel, let folderToggle, let snippetToggle { - #expect(titleField.frame.minY - statusLabel.frame.maxY >= 16, - "Snippet editor status needs deliberate breathing room below the title field.") - #expect(statusLabel.frame.minY - folderToggle.frame.maxY >= 10, - "Snippet editor status should have balanced spacing above the enable controls.") + #expect(titleField.frame.minY - statusLabel.frame.maxY >= 24, + "Snippet editor status needs a full spacing step below the title field.") + #expect(statusLabel.frame.minY - folderToggle.frame.maxY >= 14, + "Snippet editor status should keep visible breathing room above the enable controls.") #expect(abs(folderToggle.frame.midY - snippetToggle.frame.midY) <= 0.5) #expect(titleField.frame.maxY <= (titleField.superview?.bounds.maxY ?? titleField.frame.maxY) - 12, "Snippet title needs deliberate top padding.")