Skip to content

Fix persistence of Substitutions and Spelling settings#252

Merged
schuyler merged 1 commit intomainfrom
claude/issue-250-8W03L
Jan 6, 2026
Merged

Fix persistence of Substitutions and Spelling settings#252
schuyler merged 1 commit intomainfrom
claude/issue-250-8W03L

Conversation

@schuyler
Copy link
Copy Markdown
Owner

@schuyler schuyler commented Jan 6, 2026

Summary

Fixes persistence bugs for Edit → Substitutions and Edit → Spelling and Grammar settings that were preventing them from being saved across application launches.

Changes:

  • Removed hardcoded XIB defaults (dashSubstitution="YES" smartInsertDelete="YES") that were overriding NSUserDefaults values
  • Added missing smartInsertDeleteEnabled key to MPEditorKeysToObserve() so Smart Copy/Paste is now saved/restored like other settings

Behavior change: All substitution and spelling/grammar settings now default to OFF on fresh install (previously Smart Dashes and Smart Copy/Paste defaulted to ON from XIB).

Related Issue

Related to #250

Manual Testing Plan

Prerequisites

  • Clean build with fixes applied
  • macOS 10.14+ system

Key Test Scenarios

  1. Verify Default State - All 8 settings should be OFF on fresh install (after defaults delete com.macdown.MacDown)

  2. Smart Copy/Paste Persistence - Enable via Edit → Substitutions → Smart Copy/Paste, quit, relaunch - setting should remain checked

  3. Smart Dashes Persistence - Enable via Edit → Substitutions → Smart Dashes, type --, quit, relaunch - setting should persist and dashes should still convert

  4. Toggle OFF Persistence - Enable a setting, quit/relaunch, disable it, quit/relaunch - should remain OFF

  5. Multi-Document - Settings apply globally to all documents (not per-document)

Settings to Test

  • Smart Copy/Paste, Smart Quotes, Smart Dashes, Data Detectors, Text Replacement
  • Check Spelling While Typing, Check Grammar With Spelling, Correct Spelling Automatically

Review Notes

  • Groucho (Architect): Confirmed the fix approach - removing XIB overrides and adding the missing key follows the existing pattern
  • Chico (Code Review): Approved - implementation is correct, complete, and follows project conventions
  • Harpo (Documentation): No documentation updates needed
  • Zeppo (Testing): Provided comprehensive manual testing plan

Remove hardcoded XIB defaults (dashSubstitution, smartInsertDelete) that
were overriding NSUserDefaults values on document load. Add missing
smartInsertDeleteEnabled key to MPEditorKeysToObserve() so Smart Copy/Paste
setting is now saved and restored like other substitution settings.

Related to #250
@schuyler schuyler merged commit 12e2fb6 into main Jan 6, 2026
7 checks passed
@github-actions
Copy link
Copy Markdown
Contributor

github-actions bot commented Jan 6, 2026

Code Coverage Report

Current Coverage: 51.40%

Coverage Details (Summary)
Name                                                                                                                                   Coverage            
-------------------------------------------------------------------------------------------------------------------------------------- ------------------- 
MASPreferences.bundle                                                                                                                  0.00% (0/0)         
MacDown 3000.app                                                                                                                       57.74% (7242/12542) 
    /Users/runner/work/macdown3000/macdown3000/MacDown/Code/Document/MPDocument.m                                                      50.76% (771/1519)   
        MPEditorPreferenceKeyWithValueKey                                                                                              85.71% (6/7)        
        MPEditorKeysToObserve                                                                                                          100.00% (15/15)     
        __MPEditorKeysToObserve_block_invoke                                                                                           100.00% (10/10)     
        MPEditorPreferencesToObserve                                                                                                   100.00% (13/13)     
        __MPEditorPreferencesToObserve_block_invoke                                                                                    100.00% (8/8)       
        MPRectStringForAutosaveName                                                                                                    100.00% (6/6)       
        MPAreNilableStringsEqual                                                                                                       100.00% (3/3)       
        MPGetWebViewBackgroundColor                                                                                                    0.00% (0/9)         
        -[NSURL(Convert) absoluteBaseURLString]                                                                                        0.00% (0/6)         
        -[WebView(Shortcut) enclosingScrollView]                                                                                       100.00% (3/3)       
        -[MPPreferences(Hoedown) extensionFlags]                                                                                       75.00% (21/28)      
        -[MPPreferences(Hoedown) rendererFlags]                                                                                        66.67% (8/12)       
        MPGetPreviewLoadingCompletionHandler                                                                                           100.00% (25/25)     
        __MPGetPreviewLoadingCompletionHandler_block_invoke                                                                            100.00% (22/22)     
        -[MPDocument preferences]                                                                                                      100.00% (3/3)       
        -[MPDocument markdown]                                                                                                         100.00% (3/3)       
        -[MPDocument setMarkdown:]                                                                                                     100.00% (3/3)       
        -[MPDocument html]                                                                                                             0.00% (0/3)         
        -[MPDocument toolbarVisible]                                                                                                   0.00% (0/3)         
        -[MPDocument previewVisible]                                                                                                   100.00% (3/3)       
        -[MPDocument editorVisible]                                                                                                    100.00% (3/3)       
        -[MPDocument needsHtml]                                                                                                        0.00% (0/5)         
        -[MPDocument setTotalWords:]                                                                                                   0.00% (0/7)         
        -[MPDocument setTotalCharacters:]                                                                                              0.00% (0/7)         
        -[MPDocument setTotalCharactersNoSpaces:]                                                                                      0.00% (0/8)         
        -[MPDocument setAutosaveName:]                                                                                                 100.00% (4/4)       
        -[MPDocument init]                                                                                                             88.89% (8/9)        
        -[MPDocument windowNibName]                                                                                                    100.00% (3/3)       
        -[MPDocument windowControllerDidLoadNib:]                                                                                      100.00% (85/85)     
        __41-[MPDocument windowControllerDidLoadNib:]_block_invoke                                                                     100.00% (4/4)       
        -[MPDocument reloadFromLoadedString]                                                                                           100.00% (8/8)       
        -[MPDocument close]                                                                                                            0.00% (0/20)        
        +[MPDocument autosavesInPlace]                                                                                                 100.00% (2/2)       
        +[MPDocument writableTypes]                                                                                                    100.00% (3/3)       
        -[MPDocument isDocumentEdited]                                                                                                 100.00% (5/5)       
        -[MPDocument writeToURL:ofType:error:]                                                                                         0.00% (0/15)        
        -[MPDocument dataOfType:error:]                                                                                                100.00% (3/3)       
        -[MPDocument readFromData:ofType:error:]                                                                                       100.00% (8/8)       
        -[MPDocument prepareSavePanel:]                                                                                                76.92% (30/39)      
        __31-[MPDocument prepareSavePanel:]_block_invoke                                                                               100.00% (12/12)     
        -[MPDocument printInfo]                                                                                                        0.00% (0/12)        
        -[MPDocument printOperationWithSettings:error:]                                                                                0.00% (0/7)         
        -[MPDocument printDocumentWithSettings:showPrintPanel:delegate:didPrintSelector:contextInfo:]                                  0.00% (0/17)        
        -[MPDocument validateUserInterfaceItem:]                                                                                       0.00% (0/41)        
        -[MPDocument splitViewDidResizeSubviews:]                                                                                      100.00% (4/4)       

... (2383 more lines truncated)

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

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