NSTextView backed by core data, undo problems
NSTextView backed by core data, undo problems
- Subject: NSTextView backed by core data, undo problems
- From: Martin Hewitson <email@hidden>
- Date: Thu, 11 Mar 2010 16:50:35 +0100
Dear list,
I have a puzzling problem which is making my puzzler sore.
Here's the outline:
I have a core-data doc based app. I have core data entities which represent files on disk. When the entity is created, the contents of the file are loaded (in to a binary-data attribute called 'content'). Now I have an outline view which shows the project-tree of files. Double-clicking an item in the project-tree (outlineview) adds that NSManagedObject to an NSArrayController class (opened files). There is then an NSTextView which is bound to the 'content' attributed of the currently selected file in the array controller.
So far, so good. Almost everything is working as I expect.
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.
Does anyone have any insights in to what I might be doing wrong? I tried with a toy project and I'm getting the same results.
Best wishes,
Martin
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Martin Hewitson
Albert-Einstein-Institut
Max-Planck-Institut fuer
Gravitationsphysik und Universitaet Hannover
Callinstr. 38, 30167 Hannover, Germany
Tel: +49-511-762-17121, Fax: +49-511-762-5861
E-Mail: email@hidden
WWW: http://www.aei.mpg.de/~hewitson
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
_______________________________________________
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