Fix new document windows opening at bottom-left#286
Merged
schuyler merged 1 commit intoschuyler:mainfrom Jan 22, 2026
Merged
Conversation
schuyler
reviewed
Jan 22, 2026
Owner
schuyler
left a comment
There was a problem hiding this comment.
Thanks for tackling this issue!
I noticed a potential problem with the execution order. When [super makeWindowControllers] runs, it loads the nib and triggers windowControllerDidLoadNib:, which restores the saved window frame. The center call then runs after that, which means it will override the restored position for all documents, not just new ones.
A couple of options to fix this:
- Only call
centerwhenself.fileURLis nil (i.e., for new unsaved documents) - Move the centering logic into
windowControllerDidLoadNib:before the autosave restoration, so saved positions take precedence
Either approach should preserve the restored positions for previously saved documents while still fixing the (0,0) issue for new ones.
a8060ea to
4d9fc8a
Compare
Contributor
Author
|
Totally forgot about that order. I will try to fix this. |
Center the window as a fallback in windowControllerDidLoadNib: only when no saved frame position exists. This preserves saved positions for existing documents and the default position for new documents.
4d9fc8a to
8de31a3
Compare
Owner
|
@mbinkhorst Thanks for the patch! |
Contributor
Author
|
Thank you! |
schuyler
pushed a commit
that referenced
this pull request
Jan 24, 2026
Comprehensive testing plan covering all changes since v3000.0.3: - Smart quote substitution fix (#289) - Editor jumping when typing at end of long documents (#288) - New document window positioning (#286) - Graphviz/Mermaid button positioning in Compilation Settings (#280) - Adjacent shortcut-style links rendering (#275) Includes regression testing checklist for core functionality.
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
Solution
Added a fallback in
windowControllerDidLoadNib:to center the window when no saved frame position is found. This preserves the existing behavior for:Only windows with no saved position at all get centered.
Test plan
defaults delete app.macdown.macdown3000 "NSWindow Frame Untitled", create new document → centers on screen