On Jul 13, 2010, at 7:34 PM, Ross Carter wrote:

> I don't think it has anything to do with wrapping. AFAICT, layout is complete 
> before the delay begins. I think this is a bug that you need to report. Maybe 
> Doug or Aki can chime in with a solution.

Thanks for a very informative reply.

> Here are some things that I found:
> 
> 1. The problem is indeed the hyphen characters. Replace all the - with + or _ 
> and everything works fine.

Yes, I noticed this too.

> 2. The NSTypesetter method -endParagraph, and the NSLayoutManager delegate 
> method textContainer:didCompleteLayout:.... both fire quickly, as they 
> should. That's why I think layout is already over by the time the delay kicks 
> in.

Good to know--I was starting to focus on the wrong thing.

> I don't know why -insertText: causes a call to -doubleClickAtIndex: after the 
> insertion is complete

Yes, I mentioned my curiosity about that in the first post.  It seems very odd.

> or why doubleClickAtIndex: takes so long to run. If you in fact double-click 
> anywhere in the document, it runs instantly. 

Yep.  About half of the doubleClickAtIndex: time is in CFUniCharIsAMemberOf and 
a third is in CFStringGetCharacters.  Why is all this being done?

One additional observation:  If I substitute underscores for hyphens in various 
proportions of the document, it looks like the delay time scales roughly with 
the number of hyphens remaining.  That suggests that the entire document is 
being scanned as the result of one keypress.

> 3. My app, Pagehand, handles the test file just fine. I've heavily subclassed 
> all the components of the text system and I cannot tell what is fixing the 
> problem.

Doug Davidson did suggest (offline) overriding doubleClickAtIndex:.  I'm 
inexperienced in Cocoa and when I started looking at what it would take to 
subclass NSTextStorage and the prospect of doing this scares me.

> 4. As a workaround, could you use underscore characters instead of hyphens? I 
> tried using en dash and got the same result as hyphens.

I suppose I could recommend this to users, but hyphens are a long-standing 
tradition.  Funny, I also tried the en dash thinking that would "fix" it and 
was surprised when it didn't.

> 5. May I suggest that it might not be meaningful to present 70 thousand 
> characters, comprising only ACTG and -, in one scrolling text view? Mightn't 
> you present only a snippet at a time, rather than the entire sequence? Just a 
> thought.

These lines are just the data matrix component of a larger file format looking 
something like this:

   #NEXUS
   begin data;
      dimensions ntax=10 nchar=7234;
      format datatype=dna;
      matrix
         species1  ACGTACGT....
         species2  ACGTACGT....
         species3  ACGTACGT....
      ;
   end;
   begin paup;
      command...
      another_command....
      ...
   end;

Users want to edit things above and below the matrix.  Typically, they don't 
even touch the matrix in my editor (it is typically output from some other 
program).  So in that sense, this is not a big deal.  But I don't want them to 
think the program has crashed if they do happen to type something in the 
matrix.  And there are some users who actually like to "manually align" (insert 
and delete hyphen characters) in my editor, even though there are more 
appropriate tools for doing it.  I don't let the lines wrap in my editor, and 
the current Carbon version of my app has a horizontal scroll bar that allows 
them to get to the very ends of the sequences, unlike most standard text 
editors (at least the ones that don't use NSTextView, which I was pleased to 
discover handles wide scrolling ranges automatically).

> Hope this helps.

It does!  Thanks for your time.

Dave

--
David L. Swofford             david.swoff...@duke.edu
Center for Evolutionary Genomics
Institute for Genome Sciences & Policy
Box 90338
Duke University
Durham, NC 27708 USA

_______________________________________________

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