On Thu, Mar 11, 2010 at 7:50 AM, Martin Hewitson
<martin.hewit...@aei.mpg.de> 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 (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