Re: NSTextView backed by core data, undo problems
Re: NSTextView backed by core data, undo problems
- Subject: Re: NSTextView backed by core data, undo problems
- From: Kyle Sluder <email@hidden>
- Date: Thu, 11 Mar 2010 11:52:42 -0800
On Thu, Mar 11, 2010 at 7:50 AM, Martin Hewitson
<email@hidden> wrote:
> The nasty little problem I have is that if I edit the contents of a file via the NSTextView, then do 'undo', the cursor (selection) in the NSTextView jumps to the end of the document, and the scrollview jumps to the top. Almost as if the whole text has been replaced. The only way I can avoid this so far is to set the binding so that it doesn't 'update continuously'. One other symptom is that each undo removes the last character typed, whereas with 'update continuously' off I get the more common behaviour of undoing the last word or at least recent group of actions.
By setting the value continuously you're breaking the text view's undo
coalescing.
Doing this correctly is not going to be an easy task. You will need to
learn much about the Cocoa text system. The 30,000ft overview: you
want to mutate an NSTextStorage hooked up to the text view, rather
than simply setting a property on the model object. Core Data and KVC
don't support this pattern natively; you will need to write code, and
it can get hairy.
--Kyle Sluder
_______________________________________________
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