Skip to content

Comments

Add window size and position persistence#22

Draft
Copilot wants to merge 5 commits intomainfrom
copilot/remember-window-size-position
Draft

Add window size and position persistence#22
Copilot wants to merge 5 commits intomainfrom
copilot/remember-window-size-position

Conversation

Copy link
Contributor

Copilot AI commented Feb 5, 2026

Implements window geometry persistence to registry, matching native Notepad behavior.

Implementation

  • State: Added windowX, windowY, windowWidth, windowHeight to AppState with 640×480 default
  • Storage: New LoadWindowSettings() / SaveWindowSettings() functions write to HKEY_CURRENT_USER\Software\LegacyNotepad
  • Lifecycle: Load on startup before CreateWindowExW(), save on WM_DESTROY using GetWindowPlacement().rcNormalPosition

Edge Cases

  • Multi-monitor: Negative coordinates preserved via static_cast<int>(DWORD) round-trip
  • Off-screen: MonitorFromRect() validation resets to CW_USEDEFAULT if no monitor intersection
  • Maximized state: Uses rcNormalPosition so window doesn't reopen maximized unintentionally

Registry keys: WindowX, WindowY, WindowWidth, WindowHeight (REG_DWORD)

Original prompt

This section details on the original issue you should resolve

<issue_title>Remember window size and maybe position</issue_title>
<issue_description>Hello again!

Not really a bug or an issue but the og notepad remembers the window size and position of the last session. Since you already put font and always on top settings in the registry I guess this can be put there too?

Have a nice day and thanks!</issue_description>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 4 commits February 5, 2026 13:58
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
…narios

Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
…et_cast

Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Co-authored-by: ForLoopCodes <89027512+ForLoopCodes@users.noreply.github.com>
Copilot AI changed the title [WIP] Add feature to remember window size and position Add window size and position persistence Feb 5, 2026
@ForLoopCodes ForLoopCodes self-requested a review February 5, 2026 15:04
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.

Remember window size and maybe position

2 participants