Re: Two problems trying to use NSTextView for a scrolling console/terminal like view
Re: Two problems trying to use NSTextView for a scrolling console/terminal like view
- Subject: Re: Two problems trying to use NSTextView for a scrolling console/terminal like view
- From: Eric Wing <email@hidden>
- Date: Sat, 28 Dec 2013 22:11:54 -0800
On 12/28/13, Jerry Krinock <email@hidden> wrote:
>
> On 2013 Dec 28, at 15:14, Eric Wing <email@hidden> wrote:
>
>> 1) I figured out that the bottleneck was in scrollRangeToVisible call.
>
> You could see if you have better luck with -[NSView scrollPoint:].
>
>> 2) -[NSBigMutableString replaceCharactersInRange:withString:]: nil
>> argument
>
> Well, there’s the obvious answer that your other code is passing nil for
> withString:. You could check for that.
>
Thanks Jerry. You were spot on with both answers. scrollPoint is a lot
faster and can handle the large data sets (though it is not as
accurate, but I don't care).
And I was indeed passing nil. The end of my data run contained funny
characters or null characters in the byte stream so my NSString
initWithBytes:length: encoding:NSUTF8StringEncoding was failing
despite giving a length. I had wrongly assumed I was hitting some size
limit in this case since my test had run fine for the first hour and
it was painful to retest since this takes a few hours.
But I did notice a new problem. At around 800,000 lines, the
NSTextView stops displaying new appended text. Strangely, if I do a
Cmd-A, Cmd-C, and then paste to another program, I do get all the
data. So the data exists, but it NSTextView is not displaying it
correctly. I'll chalk this up to a OS X bug and move on though.
Thanks,
Eric
--
Beginning iPhone Games Development
http://playcontrol.net/iphonegamebook/
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden