fix: allow the main window to be resized horizontally#191
Open
git-lucky wants to merge 2 commits into
Open
Conversation
The root view pinned a fixed 450pt width, which made content min and max width identical and left windowResizability(.contentMinSize) with nothing to resize. ContentView already declares a flexible minWidth, so this only needed the outer frame to become a minimum. Default launch size is unchanged. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
windowWillResize rewrote every proposed width to a fixed 450pt. AppKit
consults the delegate on each resize, so that return value overrode the
window's own minSize/maxSize -- height passed through untouched, which is
why the window resized vertically but never horizontally.
Three layers pinned the width; all are addressed:
- SwiftUI .frame(width: 450) -> .frame(minWidth: 450)
- window.maxSize.width 450 -> unbounded, via a testable
applyMainWindowSizeLimits(to:)
- windowWillResize now honors the proposed size
Default launch size and the 400-900pt height range are unchanged, so
existing users see no difference until they drag the window.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Why
The main window is locked to 450pt wide and can't be widened, while it resizes vertically without complaint. Transcriptions are often long, so the narrow column makes the history list harder to read than it needs to be.
Root cause
Three independent constraints pinned the width. All three had to go — fixing any one or two alone changes nothing, which is what made this less obvious than it looks:
.frame(width: 450)on the root view set a fixed width, making the content's minimum and maximum identical..windowResizability(.contentMinSize)then had nothing to resize.adoptMainWindowsetwindow.maxSizewidth to 450, equal tominSize.width.windowWillResize(_:to:)returnedNSSize(width: 450, height: frameSize.height), rewriting the width on every resize attempt.The third was decisive: AppKit consults the delegate on each resize, and its return value overrides the window's own
minSize/maxSize. It also explains the exact symptom — height was passed through untouched while width was hardcoded, so the window resized vertically but never horizontally.What changed
.frame(width: 450).frame(minWidth: 450)window.maxSize.width450windowWillResize.defaultSizeContentViewalready declared.frame(minWidth: 400, idealWidth: 400), so the content was always built to flex — only the outer constraints prevented it.Existing users see no difference on update. The window still opens at 450 × 650; it simply can now be widened. SwiftUI persists the frame automatically, so a user who never drags it keeps exactly today's behavior.
Tests
5 new unit tests in
MainWindowResizabilityTests. The size limits are extracted intoAppDelegate.applyMainWindowSizeLimits(to:)so they can be applied to a realNSWindowand asserted, following the pattern already used byisMainAppWindow:testWindowWillResize_honorsProposedWidth— fails against the old code, passes against the new. This is the real regression guard.testWindowWillResize_leavesHeightUntouchedtestSizeLimits_allowHorizontalResizing— max width must exceed min widthtestSizeLimits_preserveMinimumWidth— 450 floor retainedtestSizeLimits_preserveHeightRange— 400–900 retainedTest plan