-
Notifications
You must be signed in to change notification settings - Fork 104
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improvements and fixes to NSTextList-related code #297
base: master
Are you sure you want to change the base?
Conversation
{ | ||
NSArray *textLists = [style textLists]; | ||
return 0; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This matches the return value in Cocoa (I'd have expected NSNotFound
but it seems to return 0 instead).
itemNumber++; | ||
} | ||
|
||
if (buffer[index-1] == '\r' && buffer[index] == '\n') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This and the use of NSCharacterSet newlineCharacterSet
may be overkill, would we use '\n' internally or do we need to support Windows CR+LF combinations?
@@ -303,6 +303,8 @@ - (id) init | |||
[_tabStops addObject: tab]; | |||
RELEASE(tab); | |||
} | |||
|
|||
ASSIGN(_textLists, [NSArray array]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instances in Cocoa always have an empty array set for the default value, so I included this here and below.
We weren't even saving the textLists in some of the serialization paths, and other fields like text blocks and text tables are ignored as well. I'd suggest deferring any work on that part unless we make the changes as a batch and bump the object version; I'm not that familiar with any of this yet, and I don't want the PR to get out of hand.
Fixes for some NSTextList-related issues (#293, #294, #295).
Changes include:
isEqual:
behavior for NSTextList and NSParagraphStyle._textLists
(similar to_tabStops
).rangeOfTextList:atIndex:
to avoid lockup conditions for adjacent ranges.itemNumberInTextList:atIndex:
to return the item number for the list.Notes: