Skip to content

Allow flexible space, space, and separator in toolbar customization#322

Merged
schuyler merged 2 commits into
mainfrom
claude/resolve-issue-313-KUpaQ
Feb 19, 2026
Merged

Allow flexible space, space, and separator in toolbar customization#322
schuyler merged 2 commits into
mainfrom
claude/resolve-issue-313-KUpaQ

Conversation

@schuyler

@schuyler schuyler commented Feb 18, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix toolbarAllowedItemIdentifiers: to include NSToolbarFlexibleSpaceItemIdentifier, NSToolbarSpaceItemIdentifier, and NSToolbarSeparatorItemIdentifier so users can drag these items from the Customize Toolbar panel
  • Fix toolbarSelectableItemIdentifiers: to return only custom item identifiers (not system spacers), preventing unintended selection state on space/separator items
  • Add 37 new unit tests in MPToolbarControllerTests.m covering all NSToolbarDelegate methods: allowed identifiers, selectable identifiers, default identifiers, item lookup, toolbar item groups, and consistency relationships between methods

Related to #313

Changes

Production code (MPToolbarController.m, 2 methods changed):

  • toolbarAllowedItemIdentifiers: — appends the three system toolbar item identifiers to the custom item list
  • toolbarSelectableItemIdentifiers: — returns custom identifiers directly instead of delegating to toolbarAllowedItemIdentifiers: (which would now incorrectly include system items)

Tests (MPToolbarControllerTests.m, 37 tests):

  • Initialization and basic state
  • Allowed identifiers include all 3 system items (the fix under test)
  • Selectable identifiers exclude system items
  • Default identifiers: correct count, ordering, exclusions, flexible space insertion
  • Item creation and lookup via toolbar:itemForItemIdentifier:willBeInsertedIntoToolbar:
  • Relationships: allowed is a superset of selectable, default items are a subset of allowed
  • Idempotency: repeated delegate calls return consistent results
  • Toolbar item groups: segmented controls, labels, view types

Documentation (plans/):

  • Updated test coverage plan and XCUITest design doc to reflect new toolbar tests

Test plan

All 37 new tests pass on CI across all 4 macOS runners (macos-14, macos-15, macos-15-intel, macos-26).

Manual verification checklist:

  • Open MacDown, right-click toolbar → "Customize Toolbar..."
  • Verify Flexible Space, Space, and Separator items appear in the palette
  • Drag Flexible Space into toolbar — confirm it renders as expanding space
  • Drag regular Space into toolbar — confirm it renders as fixed-width gap
  • Drag Separator into toolbar — confirm it renders as a vertical divider
  • Reorder items including spaces/separators via drag-and-drop
  • Remove a space/separator by dragging it off the toolbar
  • Click "Use Default Set" — confirm spaces/separators are removed and default layout restores
  • Close and reopen the Customize Toolbar panel — verify items still appear
  • Verify existing toolbar buttons (Bold, Italic, Headings, etc.) still function correctly

toolbarAllowedItemIdentifiers: was only returning custom toolbar item
identifiers, preventing users from dragging flexible spaces, regular
spaces, or separators from the Customize Toolbar panel. This adds all
three system identifiers to the allowed list.

Also fixes toolbarSelectableItemIdentifiers: to return only custom
identifiers directly, instead of delegating to toolbarAllowedItemIdentifiers:
which would now incorrectly include system items in the selectable set.

Adds comprehensive XCTest coverage for all NSToolbarDelegate methods
in MPToolbarController.

Related to #313

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

github-actions Bot commented Feb 18, 2026

Copy link
Copy Markdown
Contributor

Code Coverage Report

Current Coverage: 55.17%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       59.08% (7855/13296) 
    /Users/runner/work/macdown3000/macdown3000/Dependency/peg-markdown-highlight/HGMarkdownHighlighter.m                               85.51% (478/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.11                                                                    100.00% (3/3)       
        __39-[HGMarkdownHighlighter requestParsing]_block_invoke.13                                                                    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:]                                                                                    100.00% (11/11)     
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke                                                                   100.00% (6/6)       
        __43-[HGMarkdownHighlighter textViewDidScroll:]_block_invoke_2                                                                 100.00% (3/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)       
        -[HGMarkdownHighlighter parseAndHighlightNow]                                                                                  100.00% (3/3)       
        -[HGMarkdownHighlighter highlightNow]                                                                                          100.00% (3/3)       
        -[HGMarkdownHighlighter activate]                                                                                              100.00% (24/24)     
        -[HGMarkdownHighlighter deactivate]                                                                                            100.00% (18/18)     
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Document/MPDocument.m                                                      54.67% (1117/2043)  
        MPEditorPreferenceKeyWithValueKey                                                                                              85.71% (6/7)        
        MPEditorKeysToObserve                                                                                                          100.00% (15/15)     
        __MPEditorKeysToObserve_block_invoke                                                                                           100.00% (10/10)     
        MPEditorPreferencesToObserve                                                                                                   100.00% (14/14)     
        __MPEditorPreferencesToObserve_block_invoke                                                                                    100.00% (9/9)       
        MPRectStringForAutosaveName                                                                                                    100.00% (6/6)       
        MPAreNilableStringsEqual                                                                                                       100.00% (3/3)       

... (2656 more lines truncated)

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

@schuyler schuyler merged commit 0f273f7 into main Feb 19, 2026
9 of 10 checks passed
@schuyler schuyler deleted the claude/resolve-issue-313-KUpaQ branch February 19, 2026 00:56
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