Fix split view not maintaining 1:1 ratio on resize/maximize#321
Merged
Conversation
Override resizeSubviewsWithOldSize: in MPDocumentSplitView to preserve the current split ratio proportionally when the window is resized or maximized. Previously, NSSplitView's default behavior restored absolute pixel widths from autosave, which did not scale proportionally. Also fix the XIB's initial frames from the asymmetric 509/514 to a near-exact 511/512 split, and add a preference migration (v4) to clear stale autosave state for untitled documents. Related to #309 https://claude.ai/code/session_014rS3iuR1rVVDi4GYRq5xzT
CGFloat is double on 64-bit macOS. roundf() truncates to float precision. Related to #309 https://claude.ai/code/session_014rS3iuR1rVVDi4GYRq5xzT
Update testMigrationFromLegacySubstitutionFlagOnly and testMigrationFromBothLegacyFlags to expect version 4. Related to #309 https://claude.ai/code/session_014rS3iuR1rVVDi4GYRq5xzT
Contributor
Code Coverage ReportCurrent Coverage: 55.04% Coverage Details (Summary) |
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.
Summary
resizeSubviewsWithOldSize:inMPDocumentSplitViewto preserve the split ratio proportionally when the window is resized or maximizedNSSplitViewautosave state for untitled documentsDetails
The root cause was twofold:
Asymmetric XIB frames: The XIB defined the left pane at 509px and the right at 514px (total 1024 = 509 + 1 divider + 514). This meant the initial ratio was ~49.7%, not 50%.
No proportional resize:
NSSplitView's defaultresizeSubviewsWithOldSize:restores absolute pixel widths from autosave, which don't scale proportionally when the window is maximized or resized.The fix adds a
resizeSubviewsWithOldSize:override that computes the ratio from the old layout and applies it to the new size, with guard clauses for edge cases (collapsed panes, zero width, wrong subview count).A migration (v4) clears the stale "Untitled" autosave entry so existing users pick up the corrected XIB frames.
Test plan
Related to #309