RE: NSTextView - less efficient on loading from file?
RE: NSTextView - less efficient on loading from file?
- Subject: RE: NSTextView - less efficient on loading from file?
- From: Keith Blount <email@hidden>
- Date: Fri, 25 Feb 2005 01:43:53 -0800 (PST)
- Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys
Sorry to reply to my own post, but I still can't track
this down... I tried only updating margin notes that
were attached to character indexes in the text view
that lay before the layout manager's
firstUnlaidCharacterIndex, and this sped up the typing
to normal - but it also added a massive delay to the
updating of margin note positions, so it doesn't
really help. But - and I am probably way off - it does
seem that there is more layout going on when typing
after an inline image and calling
lineFragmentUsedRect... in RTFD data that has been
saved and read from disk rather than RTFD data that
has just been typed/dragged in. I still don't
understand why I only get this delay when typing after
images in files that have been saved to disk - if
anyone has any ideas, I would be really grateful.
Many thanks again,
Keith
--- Original Message: ---
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!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
_______________________________________________
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