Skip to content

Persist zero-corner preference#200

Merged
pascalpp merged 2 commits into
pascal/192-flip-rulersfrom
codex/192-persist-zero-corner
Jun 13, 2026
Merged

Persist zero-corner preference#200
pascalpp merged 2 commits into
pascal/192-flip-rulersfrom
codex/192-persist-zero-corner

Conversation

@pascalpp

Copy link
Copy Markdown
Owner

Summary

  • Add the four-state ZeroCorner model for ruler zero-corner selection
  • Persist prefs.zeroCorner through UserDefaults, defaulting invalid or missing values to top-left
  • Reset zero-corner state during UI-test defaults reset
  • Add core tests for raw-value stability, fallback loading, and preference write-through

Validation

  • xcodebuild -project "Free Ruler.xcodeproj" -scheme "Free Ruler" test -only-testing:FreeRulerTests

Stacked on #199 for the first child issue from #192: Persist zero-corner state.

@pascalpp pascalpp marked this pull request as ready for review June 13, 2026 03:46
@pascalpp pascalpp requested a review from Copilot June 13, 2026 03:46

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a persisted “zero corner” preference (four-state model) so the app can remember which corner acts as the shared ruler origin across launches, and ensures UI test runs reset that preference deterministically.

Changes:

  • Add a four-state ZeroCorner model and expose it as a new Prefs.zeroCorner preference.
  • Persist prefs.zeroCorner via UserDefaults with fallback-to-.topLeft loading.
  • Add unit tests validating raw-value stability, fallback loading, and write-through to UserDefaults.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
FreeRulerTests/RulerCoreTests.swift Adds tests for ZeroCorner raw values, fallback loading, and persistence to UserDefaults (plus a restore helper).
Free Ruler/Ruler.swift Introduces the ZeroCorner enum used by preferences and persistence.
Free Ruler/Prefs.swift Adds zeroCorner to default registration, loads it with fallback, and persists changes via KVO observation.
Free Ruler/AppDelegate.swift Resets zeroCorner during UI-test state reset alongside other preferences.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread Free Ruler/Ruler.swift
@pascalpp pascalpp merged commit ad82008 into pascal/192-flip-rulers Jun 13, 2026
@pascalpp pascalpp deleted the codex/192-persist-zero-corner branch June 13, 2026 04:09
@pascalpp pascalpp restored the codex/192-persist-zero-corner branch June 13, 2026 04:24
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