On Nov 26, 2008, at 4:14 AM, Arved von Brasch wrote:
I have this working almost perfectly by listening for the NSTextDidChangeNotification and searching the text for the special sequence. I've found this to be the best place to handle it, so that cut and paste operations containing the special sequence are converted properly as well. The only problem with this is that it completely screws up the Undo / Redo of the text view. It doesn't seem to be possible to use the standard shouldChangeTextInRange: and textDidChange pair, because my parser acts in response to an edit, and this would set up an infinite loop.
You need to use the should-change/did-change calls. You can protect against the infinite regress by keeping track of which changes your code is making, and not doing any work when you are notified of those particular changes. For example, you could set a flag noting that your change is in progress, and clear it when your change is done.
Douglas Davidson _______________________________________________ Cocoa-dev mailing list ([email protected]) 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 [EMAIL PROTECTED]
