Hi, I have an NSTextStorage subclass, and I need to do post-processing that 
will replace the text with an altered version.

From what I can understand, it appears that in order for me to pick it up once 
all the user changes are done, I need to override the processEditing and change 
the text to what I want it to be.

But when I do this, I keep getting the dreaded:
  NSRunStorage, _NSBlockNumberForIndex(): index () beyond array bounds () 
(NSRangeException)
error.

The way I am doing it now is that I have an instance variable that says whether 
I am doing my post-processing, and if not, I set my post-processing flag, call 
my method which regenerates the contents using beginEditing, 
replaceCharactersInRange:withString:, setAttributes:range, and endEditing, and 
then turn off my post-processing flag. If processEditing is called when the 
post-processing is happening, then it just calls the super processEditing 
method.

My questions are:
1. Is this the right approach to take?
2. Are there any examples out there which do this kind of post-processing (I'm 
thinking of programmer's editors where it may change the colors and 
capitalization etc)?

Thanks

Gideon


_______________________________________________

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

Reply via email to