Re: Out of bounds exception from NSTextView
Re: Out of bounds exception from NSTextView
- Subject: Re: Out of bounds exception from NSTextView
- From: Satoshi Matsumoto <email@hidden>
- Date: Fri, 02 Sep 2005 07:43:30 +0900
My message posted on yesterday 10:26 am JST was lost while the list server
had been down for 17 hours. So I post this again.
-------
on 05.9.1 9:41 AM, Brant Sears at email@hidden wrote:
> I'm calling insertText: with an NSString on an NSTextView. I'm getting an
> exception when I do this with a long string (20496 in length). Is there a way
> to tell that a string is too big before you try to call insertText:? The
> appKit reference doesn't even say that it might raise an exception.
>
> The exception says NSRunStorage beyond bounds (2000).
> What is the right thing to do to avoid this?
I don't know whether insertText: has a maximum limit or not.
But please try to use the method replaceCharactersInRange: for the
textStorage as below.
NSRange range = [myTextView selectedRange];
[myTextView shouldChangeTextInRange:range replacementString:string];
[[myTextView textStorage] replaceCharactersInRange:range
withString:string];
[myTextView didChangeText];
Satoshi
-----------------------------------------------------
Satoshi Matsumoto <email@hidden>
816-5 Odake, Odawara, Kanagawa, Japan 256-0802
_______________________________________________
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