Dynamic modification of text search results
Dynamic modification of text search results
- Subject: Dynamic modification of text search results
- From: Martin Hewitson <email@hidden>
- Date: Wed, 04 Jul 2012 15:16:40 +0200
Dear List,
I asked this question in January but didn't get a reply. Since I haven't come up with any good/solid ideas myself, I thought I'd ask again, in case this time it triggers some thought.
I have an app which managed a bunch of files and presents these text files for viewing and editing in NSTextViews. I have implemented a project-wide search functionality which works fine, but with one problem. If the user changes the text in one file after making a search, then the search results are no longer valid for that file. A typical use-case is to make a search for a word or phrase, then go through each result and modify it. Problem is, after the first modification by the user, the subsequent results for that file are no longer accurate/valid. A result constitutes the file that the match is in, and the range within the text.
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 changes you make in the editor, the search results seem to be updated on the fly.
Cheers,
Martin
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden