Re: Dynamic modification of text search results

2012-07-05 Thread Martin Wierschin
> 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. Not too ungainly, no. But then you're maintaining the matches in an external

Re: Dynamic modification of text search results

2012-07-05 Thread Martin Hewitson
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 rem

Re: Dynamic modification of text search results

2012-07-04 Thread Ross Carter
On Jul 4, 2012, at 5:43 PM, Martin Wierschin wrote: > > Instead, you'll want to use a custom attribute/name, eg: > >NSString* TPDocumentMatchAttributeName = @"TPDocumentMatchAttribute"; >... >[storage addAttribute:TPDocumentMatchAttributeName value:match > range:match.range]; > R

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Wierschin
> It turns out to be pretty easy for me to add my 'match' objects to the the > text storages. I just needed to make the match class (TPDocumentMatch) a > subclass of NSTextAttachment. Then once I've collected all my matches for a > given file, I do > > [storage beginEditing]; > for (TPDocumen

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 07:32 PM, Marco Tabini wrote: > > On 2012-07-04, at 1:01 PM, Martin Hewitson wrote: > >> >> On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results when the underlying source text changes?

Re: Dynamic modification of text search results

2012-07-04 Thread Marco Tabini
On 2012-07-04, at 1:01 PM, Martin Hewitson wrote: > > On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: > >>> Does anyone have any good suggestions as to how to update my search results >>> when the underlying source text changes? Do I have to listen for all >>> changes from the underlying t

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results >> when the underlying source text changes? Do I have to listen for all changes >> from the underlying text objects and try to adapt, or is there a better >> pattern

Re: Dynamic modification of text search results

2012-07-04 Thread Martin Hewitson
On 4, Jul, 2012, at 03:22 PM, Marco Tabini wrote: >> Does anyone have any good suggestions as to how to update my search results >> when the underlying source text changes? Do I have to listen for all changes >> from the underlying text objects and try to adapt, or is there a better >> pattern

Re: Dynamic modification of text search results

2012-07-04 Thread Marco Tabini
> Does anyone have any good suggestions as to how to update my search results > when the underlying source text changes? Do I have to listen for all changes > from the underlying text objects and try to adapt, or is there a better > pattern for doing this? Xcode does this nicely: no matter what