Thank you all for the ideas and input. In the end the text attachment idea works perfectly. There's only one additional feature that would be nice: if a search result is deleted from the textview (which means the attachment is deleted) it would be nice to update the list of search results to remove the deleted match. I guess I could get notifications of the text storage changing, but that doesn't feel so nice. When should it stop observing the text storage? Most of the subsequent changes may have nothing to do with the search results, so checking for all text attachments each time the text storage changes feels very heavy handed. Still some more thinking to do on that part. I've noticed that Xcode doesn't update its search results when a match is deleted from the text view, so I'm not alone.
Thanks again, Martin On 5, Jul, 2012, at 02:45 AM, Ross Carter wrote: > On Jul 4, 2012, at 5:43 PM, Martin Wierschin <mar...@nisus.com> wrote: > >> >> Instead, you'll want to use a custom attribute/name, eg: >> >> NSString* TPDocumentMatchAttributeName = @"TPDocumentMatchAttribute"; >> ... >> [storage addAttribute:TPDocumentMatchAttributeName value:match >> range:match.range]; >> > > Regarding the other solution--just do another search when the text > changes--you only have to search the range that was changed, not the entire > text storage, right? That doesn't seem like it would be too ungainly. > > Ross > _______________________________________________ > > 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: > https://lists.apple.com/mailman/options/cocoa-dev/martin.hewitson%40aei.mpg.de > > This email sent to martin.hewit...@aei.mpg.de _______________________________________________ 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: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com