Skip to content

Fix split view not maintaining 1:1 ratio on resize/maximize#321

Merged
schuyler merged 4 commits into
mainfrom
claude/resolve-issue-309-EOavk
Feb 19, 2026
Merged

Fix split view not maintaining 1:1 ratio on resize/maximize#321
schuyler merged 4 commits into
mainfrom
claude/resolve-issue-309-EOavk

Conversation

@schuyler

@schuyler schuyler commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Override resizeSubviewsWithOldSize: in MPDocumentSplitView to preserve the split ratio proportionally when the window is resized or maximized
  • Fix asymmetric XIB initial frames (509/514 → 511/512) for near-exact 50/50 default split
  • Add preference migration v4 to clear stale NSSplitView autosave state for untitled documents
  • Update test expectations for new migration version

Details

The root cause was twofold:

  1. 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%.

  2. No proportional resize: NSSplitView's default resizeSubviewsWithOldSize: 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

  • CI passes on all 4 macOS runners (14, 15 ARM, 15 Intel, 26)
  • Manual: Open new untitled document → editor and preview should be equal width
  • Manual: Maximize window → split ratio should remain 1:1
  • Manual: Drag divider to custom ratio → maximize → ratio should be preserved
  • Manual: Hide/restore a pane → ratio should be preserved

Related to #309

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
Update testMigrationFromLegacySubstitutionFlagOnly and
testMigrationFromBothLegacyFlags to expect version 4.

Related to #309

https://claude.ai/code/session_014rS3iuR1rVVDi4GYRq5xzT
@github-actions

github-actions Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report

Current Coverage: 55.04%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       58.87% (7915/13444) 
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Document/MPAsset.m                                                         92.86% (104/112)    
        -[MPAsset typeName]                                                                                                            100.00% (3/3)       
        -[MPAsset defaultTypeName]                                                                                                     100.00% (3/3)       
        +[MPAsset assetWithURL:andType:]                                                                                               100.00% (3/3)       
        -[MPAsset initWithURL:andType:]                                                                                                87.50% (7/8)        
        -[MPAsset init]                                                                                                                100.00% (3/3)       
        -[MPAsset templateForOption:]                                                                                                  0.00% (0/7)         
        -[MPAsset htmlForOption:]                                                                                                      100.00% (28/28)     
        -[MPStyleSheet defaultTypeName]                                                                                                100.00% (3/3)       
        +[MPStyleSheet CSSWithURL:]                                                                                                    100.00% (3/3)       
        -[MPStyleSheet templateForOption:]                                                                                             100.00% (20/20)     
        -[MPScript defaultTypeName]                                                                                                    100.00% (3/3)       
        +[MPScript javaScriptWithURL:]                                                                                                 100.00% (3/3)       
        -[MPScript templateForOption:]                                                                                                 100.00% (20/20)     
        -[MPEmbeddedScript htmlForOption:]                                                                                             100.00% (5/5)       
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Extension/DOMNode+Text.m                                                   0.00% (0/94)        
        -[NSString(WordCount) numberOfWords]                                                                                           0.00% (0/11)        
        __36-[NSString(WordCount) numberOfWords]_block_invoke                                                                          0.00% (0/3)         
        -[NSString(WordCount) lengthWithoutNewlines]                                                                                   0.00% (0/11)        
        __44-[NSString(WordCount) lengthWithoutNewlines]_block_invoke                                                                  0.00% (0/3)         
        -[NSString(WordCount) lengthWithoutWhitespacesAndNewlines]                                                                     0.00% (0/11)        
        __58-[NSString(WordCount) lengthWithoutWhitespacesAndNewlines]_block_invoke                                                    0.00% (0/3)         
        MPGetChildrenNodetextCount                                                                                                     0.00% (0/6)         
        MPGetNodeTextCount                                                                                                             0.00% (0/38)        
        -[DOMNode(Text) textCount]                                                                                                     0.00% (0/8)         
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlightingStyle.m                         87.69% (57/65)      
        +[HGMarkdownHighlightingStyle colorFromARGBColor:]                                                                             100.00% (6/6)       
        -[HGMarkdownHighlightingStyle initWithType:attributesToAdd:toRemove:fontTraitsToAdd:]                                          88.89% (8/9)        
        -[HGMarkdownHighlightingStyle initWithStyleAttributes:baseFont:]                                                               86.00% (43/50)      
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Utility/FileURLInlining.m                                                  27.37% (26/95)      
        +[FileURLInlining inlineFromIterable:]                                                                                         0.00% (0/11)        
        -[FileURLInlining initWithURL:]                                                                                                0.00% (0/6)         
        -[FileURLInlining init]                                                                                                        100.00% (4/4)       
        -[FileURLInlining inlineContent]                                                                                               0.00% (0/9)         
        -[FileURLInlining imageContent]                                                                                                0.00% (0/12)        
        +[FileURLInlining mimeTypeForFilePath:]                                                                                        100.00% (22/22)     
        -[FileURLInlining clippingContent]                                                                                             0.00% (0/4)         
        +[FileURLInlining isTextClippingAtPath:]                                                                                       0.00% (0/12)        
        +[FileURLInlining textContentFromClipping:]                                                                                    0.00% (0/15)        
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Extension/hoedown_html_patch.c                                             85.93% (116/135)    
        hoedown_patch_reset_checkbox_index                                                                                             100.00% (3/3)       
        hoedown_patch_get_checkbox_index                                                                                               0.00% (0/3)         
        hoedown_patch_render_blockcode                                                                                                 87.27% (48/55)      
        hoedown_patch_render_listitem                                                                                                  100.00% (45/45)     
        hoedown_patch_render_toc_header                                                                                                68.97% (20/29)      
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Application/MPMainController.m                                             41.99% (97/231)     

... (2611 more lines truncated)

📊 **Full coverage report available in workflow artifacts**

@schuyler schuyler merged commit 6d28c55 into main Feb 19, 2026
8 of 9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants