Skip to content

Fix: number NSTextAlignment as AppKit does - #893

Open
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/nstextalignment-values
Open

Fix: number NSTextAlignment as AppKit does#893
DTW-Thalion wants to merge 1 commit into
gnustep:masterfrom
DTW-Thalion:fix/nstextalignment-values

Conversation

@DTW-Thalion

Copy link
Copy Markdown
Contributor

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

NSTextAlignment NSRightTextAlignment and NSCenterTextAlignment have different values from AppKit

1 participant