You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current GNUStep implementation instead returns the index position of the list within the lists for the current paragraph style. This gives you the nesting level instead of the item number.
For a text position anywhere in, say, "Delta," Apple's implementation would return 4 as it's the fourth item in the list. The current GNUstep implementation returns 0 as the list is the zeroth item in the paragraph style's lists array.
I've been playing around with this locally but I'd encourage someone else with access to a Mac to verify the difference as well. Note that if you write a test program of your own with Cocoa on recent Macs, you'll probably want to opt-out of TextKit 2 behavior via [textView layoutManager] for an equal comparison to GNUStep.
If it turns out to be a valid bug, some thoughts based on my current, hacky workaround: Get the entire range of the list from rangeOfTextList:atIndex:, iterate over the range looking for newline characters, and basically count paragraphs until it reaches the position we were asked about. You'd also want to check against the lists in each paragraph's style to account for things like nested lists.
The text was updated successfully, but these errors were encountered:
Per Apple documentation, NSAttributeString's
itemNumberInTextList:atIndex:
should return the index of the item at the specified location within the list.The current GNUStep implementation instead returns the index position of the list within the lists for the current paragraph style. This gives you the nesting level instead of the item number.
libs-gui/Source/NSAttributedString.m
Lines 1095 to 1112 in fb61a0f
For an example, consider the following list:
For a text position anywhere in, say, "Delta," Apple's implementation would return 4 as it's the fourth item in the list. The current GNUstep implementation returns 0 as the list is the zeroth item in the paragraph style's lists array.
I've been playing around with this locally but I'd encourage someone else with access to a Mac to verify the difference as well. Note that if you write a test program of your own with Cocoa on recent Macs, you'll probably want to opt-out of TextKit 2 behavior via
[textView layoutManager]
for an equal comparison to GNUStep.If it turns out to be a valid bug, some thoughts based on my current, hacky workaround: Get the entire range of the list from
rangeOfTextList:atIndex:
, iterate over the range looking for newline characters, and basically count paragraphs until it reaches the position we were asked about. You'd also want to check against the lists in each paragraph's style to account for things like nested lists.The text was updated successfully, but these errors were encountered: