Add reader-only startup and preview find#447
Open
clambertus wants to merge 1 commit into
Open
Conversation
Assisted-by: OpenAI Codex
schuyler
requested changes
Jun 22, 2026
Owner
There was a problem hiding this comment.
Thanks for the PR, @clambertus!
Issues
- Find result count never shows: in
searchPreviewForString:forward:,self.previewFindStatusLabel.hidden = foundhides the label whenever matches exist, so the computed match count is set but never displayed and only "No Results" is ever visible. - Headless test skips pass silently: three new tests
returnearly when panes aren't initialized, so they report green in CI without asserting anything, whereXCTSkip()would make those skips visible.
Suggestions
- Highlights on re-render: preview find highlights and the current-match index are wiped when the preview re-renders, leaving the find bar visible but the highlights gone, so re-applying after render (or noting the limitation) would help.
- Find pasteboard on miss:
setFindPasteboardString:runs before a match is confirmed, so a failed search still overwrites the shared system find pasteboard. - Find bar teardown: the find bar added to
window.contentViewisn't explicitly removed on an abrupt close, so an explicit teardown or a note would be clearer. - Validation fallthrough:
MPMainController.validateUserInterfaceItem:returnsYESfor unrecognized actions, where calling[super validateUserInterfaceItem:item]would be safer against future MPMainController-targeted items. - Inline search JS: the large search script is embedded as a string literal and run via the synchronous
stringByEvaluatingJavaScriptFromString:, where an external.jsresource (as withupdateHeaderLocations.js) and the existingJSContextpattern would fit the codebase better. - WebView readiness guard:
clearPreviewFindHighlightsevaluates JS onself.previewwithout anisPreviewReady-style guard, which could fire after the WebView is torn down. - Preference migration: the
loadDefaultUserDefaultsseeding ofeditorStartInReaderModeruns every launch without a version guard, where folding it into the versionedapplyPreferencesMigrationssystem would be more consistent. - First-responder timing:
updateFirstResponderForVisiblePanestargetspreview.mainFrame.frameView.documentView, which can be nil between frame loads during layout and drop key events. - Pure-function test:
MPJavaScriptStringLiteralsits on the find-string-to-JS boundary and is easily unit-testable (quotes, backslashes,%, unicode, empty/nil). - In-app help:
help.mddoesn't mention the new preview/reader Find shortcuts and its preferences screenshot still shows the old "Start in preview mode" label.
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
This adds a preference to open documents in reader-only mode, with the editor pane hidden, and makes Find commands work when only the preview/reader pane is visible.
Changes
Testing
git diff --checkxcodebuild build -workspace "MacDown 3000.xcworkspace" -scheme MacDownxcodebuild test -workspace "MacDown 3000.xcworkspace" -scheme MacDown -enableCodeCoverage YES -derivedDataPath DerivedData -resultBundlePath TestResults.xcresultxcodebuild analyze -workspace "MacDown 3000.xcworkspace" -scheme MacDownTest result: 875 tests, 0 failures.
Note: CocoaPods regenerated only the
PODFILE CHECKSUMinPodfile.lock; dependency versions did not change.Assisted-by: OpenAI Codex