Skip to content

Fix Settings panel layout clipping and field overlap#399

Merged
schuyler merged 3 commits into
mainfrom
claude/resolve-issue-397-3bSeu
Apr 22, 2026
Merged

Fix Settings panel layout clipping and field overlap#399
schuyler merged 3 commits into
mainfrom
claude/resolve-issue-397-3bSeu

Conversation

@schuyler

Copy link
Copy Markdown
Owner

Summary

Three Auto Layout bugs in the Settings/Preferences window caused content to be clipped or fields to overlap. All three share the same root cause: XIB root view frames and internal container constraints were too small for their content. (MPPreferencesViewController.m freezes each panel at the size of its XIB root frame, so any content needing more space gets clipped.)

  • Editor tab: The Behavior NSBox had a hard-coded height=175pt constraint. Seven checkboxes need ~182pt minimum — the last checkbox ("Auto-increment numbering in ordered lists") was clipped. Fixed by increasing the constraint to 200pt and the panel height from 402→427pt.

  • General tab: Eight checkboxes had explicit height=14pt constraints, forcing them below their 18pt intrinsic height. Removed these constraints so buttons render correctly. Panel height increased from 289→325pt to accommodate the taller content (and provide breathing room for longer French translations).

  • Rendering/Html tab: The CSS popup (161pt) + segmented control (118pt) + margins summed to ~412pt, exceeding the 405pt panel width, causing horizontal overflow. Panel width increased from 405→430pt.

Also adds three regression tests asserting minimum frame dimensions, so future changes cannot silently re-introduce clipping.

Related Issue

Related to #397

Manual Testing Plan

  1. Open MacDown → Preferences (Cmd+,)
  2. Editor tab: Scroll to the bottom of the Behavior section — all checkboxes should be fully visible, including "Auto-increment numbering in ordered lists"
  3. General tab: Confirm all checkboxes render at full height with readable labels and no vertical clipping
  4. Rendering tab: Confirm the CSS and Theme fields are fully visible side-by-side with no horizontal overlap

French locale testing:

  1. In Terminal: defaults write com.uranusjr.macdown3000 AppleLanguages '("fr")'
  2. Relaunch MacDown and open Preferences
  3. Check General, Editor, and Rendering tabs for label readability
  4. Restore: defaults delete com.uranusjr.macdown3000 AppleLanguages

Edge cases: Toggle between tabs several times to confirm no reflow artifacts; verify on Retina display for pixel alignment around the Behavior box border.

Review Notes

  • Arithmetic verified: Editor box 200pt yields 184pt content area (200−16pt title/border), which fits 7×18pt buttons + 6×6pt gaps + 10pt top + 10pt bottom = 182pt. General tab delta = 9 buttons × 4pt = 36pt matches the 289→325pt root height change exactly.
  • XIB canvas frame hints in MPGeneralPreferencesViewController.xib were not refreshed (requires Xcode on macOS); this is cosmetic and does not affect runtime layout.

claude added 2 commits April 22, 2026 05:53
Three Auto Layout problems caused content to be clipped or overlapping
in the Settings window:

- Editor tab: Behavior box height constraint was 175pt, insufficient
  for 7 checkboxes (needed ~182pt). Increased to 200pt and expanded
  root view height from 402pt to 427pt.

- General tab: Eight checkboxes had explicit height=14pt constraints,
  forcing them below their 18pt intrinsic height. Removed these
  constraints so buttons render at full height. Expanded root view
  height from 289pt to 325pt to accommodate the taller content.

- Rendering/Compilation tab: CSS popup (161pt) + segmented control
  (118pt) + margins exceeded the 405pt panel width, causing horizontal
  overflow. Expanded root view width from 405pt to 430pt.

Also adds regression tests asserting minimum frame dimensions for all
three panels, so future changes cannot silently re-introduce clipping.

Related to #397
The editor panel width was not changed by the issue #397 fix, so the
width assertion was testing a pre-existing invariant rather than a
regression guard. Remove it to keep the test file focused.

Related to #397
@github-actions

github-actions Bot commented Apr 22, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report

Current Coverage: 60.44%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       62.05% (8719/14051) 
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Preferences/MPHtmlPreferencesViewController.m                              0.00% (0/112)       
        MPPrismDefaultThemeName                                                                                                        0.00% (0/2)         
        -[MPHtmlPreferencesViewController viewIdentifier]                                                                              0.00% (0/3)         
        -[MPHtmlPreferencesViewController toolbarItemImage]                                                                            0.00% (0/3)         
        -[MPHtmlPreferencesViewController toolbarItemLabel]                                                                            0.00% (0/2)         
        -[MPHtmlPreferencesViewController viewWillAppear]                                                                              0.00% (0/4)         
        -[MPHtmlPreferencesViewController changeStylesheet:]                                                                           0.00% (0/7)         
        -[MPHtmlPreferencesViewController changeHighlightingTheme:]                                                                    0.00% (0/7)         
        -[MPHtmlPreferencesViewController invokeStylesheetFunction:]                                                                   0.00% (0/23)        
        -[MPHtmlPreferencesViewController invokeHighlightingThemeFunction:]                                                            0.00% (0/33)        
        -[MPHtmlPreferencesViewController loadStylesheets]                                                                             0.00% (0/13)        
        -[MPHtmlPreferencesViewController loadHighlightingThemes]                                                                      0.00% (0/15)        
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlighter.m                               82.47% (461/559)    
        styleparsing_error_callback                                                                                                    90.00% (9/10)       
        -[HGMarkdownHighlighter init]                                                                                                  92.86% (13/14)      
        -[HGMarkdownHighlighter initWithTextView:]                                                                                     83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:]                                                                        83.33% (5/6)        
        -[HGMarkdownHighlighter initWithTextView:waitInterval:styles:]                                                                 83.33% (5/6)        
        -[HGMarkdownHighlighter parseText:]                                                                                            100.00% (9/9)       
        -[HGMarkdownHighlighter convertOffsets:text:]                                                                                  26.19% (11/42)      
        -[HGMarkdownHighlighter requestParsing]                                                                                        100.00% (15/15)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke                                                                       100.00% (12/12)     
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.55                                                                    100.00% (3/3)       
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.67                                                                    100.00% (4/4)       
        -[HGMarkdownHighlighter getClearFontTraitMask:]                                                                                88.89% (16/18)      
        -[HGMarkdownHighlighter clearHighlightingForRange:]                                                                            100.00% (31/31)     
        __51-[HGMarkdownHighlighter clearHighlightingForRange:]_block_invoke                                                           100.00% (8/8)       
        -[HGMarkdownHighlighter readClearTextStylesFromTextView]                                                                       100.00% (17/17)     
        -[HGMarkdownHighlighter applyHighlighting:withRange:]                                                                          80.00% (60/75)      
        __53-[HGMarkdownHighlighter applyHighlighting:withRange:]_block_invoke                                                         92.31% (12/13)      
        -[HGMarkdownHighlighter applyVisibleRangeHighlighting]                                                                         100.00% (16/16)     
        -[HGMarkdownHighlighter clearHighlighting]                                                                                     100.00% (3/3)       
        -[HGMarkdownHighlighter cacheElementList:]                                                                                     100.00% (6/6)       
        -[HGMarkdownHighlighter clearElementsCache]                                                                                    100.00% (2/2)       
        -[HGMarkdownHighlighter textViewTextDidChange:]                                                                                0.00% (0/11)        
        __47-[HGMarkdownHighlighter textViewTextDidChange:]_block_invoke                                                               0.00% (0/3)         
        -[HGMarkdownHighlighter textViewDidScroll:]                                                                                    27.27% (3/11)       
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke                                                                   0.00% (0/6)         
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke_2                                                                 0.00% (0/3)         
        -[HGMarkdownHighlighter getDefaultStyles]                                                                                      100.00% (27/27)     
        -[HGMarkdownHighlighter applyStyleDependenciesToTargetTextView]                                                                92.86% (13/14)      
        -[HGMarkdownHighlighter setStyles:]                                                                                            100.00% (8/8)       
        -[HGMarkdownHighlighter getDefaultSelectedTextAttributes]                                                                      100.00% (7/7)       
        -[HGMarkdownHighlighter handleStyleParsingError:]                                                                              100.00% (12/12)     
        -[HGMarkdownHighlighter applyStylesFromStylesheet:withErrorHandler:]                                                           86.05% (74/86)      
        -[HGMarkdownHighlighter setTargetTextView:]                                                                                    100.00% (7/7)       

... (3167 more lines truncated)

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

Calling [vc view] in a unit test context loads the NIB and activates
all CocoaBindings (e.g. self.preferences.markdownManualRender). This
causes a crash in the test environment where the full app infrastructure
is not running. The visual fixes in the XIB files remain correct.

Related to #397
@schuyler schuyler merged commit 4138904 into main Apr 22, 2026
9 checks passed
schuyler pushed a commit that referenced this pull request Jun 22, 2026
The Preferences panes pinned their content to the hard-coded English XIB
frame size, so longer localized strings (French, Italian) overlapped or
were clipped regardless of window size. PR #399 bumped the fixed sizes but
did not generalize.

- MPPreferencesViewController.loadView now keeps the designed width but
  measures the height the content needs at that width for the active
  locale (Auto Layout fitting size), never shrinking below the English
  design height. Resizable + centered-content behavior is preserved.
- Editor "Behavior" box: drop the fixed height=200 constraint and anchor
  the box content to its last checkbox so it hugs wrapped text.
- Compilation/HTML pane: decouple the "CSS:" label width from the
  "Default path:" label (it forced the CSS column wide in French and
  overlapped the Theme controls); give the CSS label its own leading.
- Enable word wrapping on checkbox titles across all panes.
- Add tests asserting boxes hug content, label widths are independent,
  checkboxes wrap, panes are unambiguous, and content is sized to fit.

Related to #397
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