Re: NSDocument autosave doesn't show as edited
Re: NSDocument autosave doesn't show as edited
- Subject: Re: NSDocument autosave doesn't show as edited
- From: Kevin Perry <email@hidden>
- Date: Wed, 23 May 2012 08:30:20 -0700
Does "Revert to Last Saved" become available after saving and editing? Which NSDocument methods are you overriding?
It is indeed -updateChangeCount: that controls the 'Edited' state. You might try overriding with a call to super and setting a breakpoint or adding a log to make sure it's being called as expected (with NSChangeDone). That should be getting called by the undo mechanism, but it would be good to verify.
The only other idea I have is that maybe you need to invoke -[NSTextView breakUndoCoalescing] before saving, like TextEdit does.
-KP
On May 23, 2012, at 8:18 AM, Martin Hewitson <email@hidden> wrote:
> Dear list,
>
> I have an NSDocument app that implements autosave and versions on Lion. The NSDocument subclass is essentially a text editor. If I create a new document and type something in the text view then the 'Edited' tag appears. I then save the document to disk. After this, typing in the text view no longer triggers the 'Edited' state and hence no versions are autosaved. However, using "Save a Version" works fine, and I can view the versions in the versions browser.
>
> Does anyone have a clue what I'm missing? As I understand it, if I'm using the default NSDocument undo mechanism (which I believe I am - at least undo/redo works on the editor) then I don't need to manually call -updateChangeCount:.
>
> What else could I be doing wrong?
>
> Many thanks for any suggestions,
>
> Martin_______________________________________________
>
> 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
_______________________________________________
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