Text Storage problem
Text Storage problem
- Subject: Text Storage problem
- From: "Josh Ferguson" <email@hidden>
- Date: Tue, 18 Jun 2002 11:30:31 -0500
- Thread-topic: Text Storage problem
Ok, I'm at the end of my rope here and can't get past this problem I'm having with Text Storage. I've subclassed NSTextStorage in order to do syntax coloring in a simple text editor. I've implemented the following methods:
attributesAtIndex:effectiveRange
fixAttributesInRange:
fixAttributesLazily:
string:
setAttributes:range:
replaceCharactersInRange:withString:
I've set up the textView's layout manager to use my text storage. When I type a letter, the correct functions are getting called, and in debug I can see that the attributed string in the text storage is receiving the correct values. The strange part is, the attribtuesAtIndex function gets called three times. The first time it's called it receives the index 0 (since it's the first character that I'm typing into the document). The second time is the same (both of these seem to work), but then the third time the method is called, the index that it's trying to get attributes for is 39 (this is in a black document!). This seems to be screwing everything up. In the call stack, it looks like the textView calls it twice, and the third time it is called by the layout manager. Anyone have any idea what's going on here?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.