Fix: number NSTextAlignment as AppKit does - #893
Open
DTW-Thalion wants to merge 1 commit into
Open
Conversation
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.
NSTextAlignment numbered right 1 and centre 2, where AppKit numbers centre 1 and right 2 (issue #752). Left, justified and natural already agreed. Code that uses the names round-tripped, but the raw value differs, so a keyed archive written by one library and read by the other swaps right and centre.
The constants are now left 0, centre 1, right 2, justified 3 and natural 4, read from a macOS runner. This breaks the values already stored in archives, which is what was agreed in the issue.
NSParagraphStyle keeps its own alignment in an archive that is not keyed, so its class version goes to 4 and a version below that has right and centre swapped back on decode. NSCell stores the alignment in the NSCellFlags2 bits of a keyed archive, where there is no version to test, so a document saved with a right aligned cell reads as centred until it is saved again. GSXib5KeyedUnarchiver reads the alignment from the strings in the xib and needs no change.
Tests/gui/NSText/alignmentValues.m pins the five values, the current names against the deprecated ones, the class version, and a paragraph style through an archive that is not keyed. It fails 4 and passes 29 before, and passes 11 more after; Tests/gui is otherwise unchanged.
Closes #752