On Mon, Nov 9, 2009 at 9:28 AM, Douglas Davidson <ddavi...@apple.com> wrote: > Yes, that's correct. Within a given text view, the character indexes are > the same between the text storage and its underlying string, and these are > the character indexes used by the layout manager and the text view.
The documentation seems to be in conflict on this point. -[NSAttributedString string] says the following: > This method doesn’t strip out attachment characters; use NSText's string > method to extract just the linguistically significant characters. > > For performance reasons, this method returns the current backing store of the > attributed string object. If you want to maintain a snapshot of this as you > manipulate the returned string, you should make a copy of the appropriate > substring. But -[NSText string] also says this: > For performance reasons, this method returns the current backing store of the > text object. If you want to maintain a snapshot of this as you manipulate the > text storage, you should make a copy of the appropriate substring. Which implies that -[NSText string] is implemented to just return [[self textStorage] string], which would defy -[NSAttributedString string]'s documentation. I think NSAttributedString is in error here; will file a doc bug soon. --Kyle Sluder _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com