NSTextView - less efficient on loading from file?
NSTextView - less efficient on loading from file?
- Subject: NSTextView - less efficient on loading from file?
- From: Keith Blount <email@hidden>
- Date: Thu, 24 Feb 2005 14:29:14 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Hello,
I am encountering a strange problem with NSTextView
and would be very grateful for any ideas.
I have a text view attached to a custom view that
stores margin notes that are attached to the text in
the text view. Whenever the user changes any text, I
calculate the new positions of all the margin notes
below that point. All this works very quickly for the
most part.
However, what I have found is that if I have an image
in the text, and try placing the insertion point after
the image and typing, typing is *extremely* slow. This
is apparently caused by the calculations I do using
lineFragmentUsedRectForGlyphAtIndex, because it only
affects text if there are lots of margin notes below
it - and yet in other areas of text (when not typing
next to an image) these calculations are usually so
fast that they do not affect the speed at all.
On further testing what I found was this: if I drag an
image into the text view and try typing after it,
there is no slowdown. But if I then save the file to
disk, close and reopen it, the slowdown appears.
My wild guess at this is that perhaps, before the file
is saved to disk, the text and images are in memory
and so lineFragmentUsedRectForGlyphAtIndex... works
quickly, but after the file is read from disk, the
calculations slow down... or something.
If there are any text system experts out there who
might be able to help me find the cause of this
problem, I would be very grateful.
Many thanks in advance,
Keith
__________________________________
Do you Yahoo!?
Yahoo! Mail - Find what you need with new enhanced search.
http://info.mail.yahoo.com/mail_250
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden