On May 23, 2012, at 9:43 AM, Martin Hewitson <martin.hewit...@aei.mpg.de> wrote:
>> 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.
> 
> It's being called only once when the document is loaded. It gets called with 
> NSChangeCleared, which I guess is what you would expect. I've no idea why it 
> isn't called after edits.
> 
> If I return NO from autosavesInPlace, I see the same behaviour. The dirty dot 
> in the red button does not appear after an edit. If I listen for text did 
> change notifications from the text view and call -updateChangeCount in there, 
> then everything works normally.

Perhaps the NSTextView's NSUndoManager isn't the same as the NSDocument's?

This is supposed to work automatically, but maybe you've done something to 
prevent this. If its delegate doesn't specify one, the NSTextView searches the 
responder chain for something that responds to -undoManager. Usually that's the 
NSWindow. If its delegate doesn't specify one, the window will get its undo 
manager from [[[self windowController] document] undoManager].

Compare the pointers of [textView undoManager] and [document undoManager]. I 
suspect they're different.
_______________________________________________

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:
https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com

This email sent to arch...@mail-archive.com

Reply via email to