Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
- Subject: Re: Docs by Contradiction: -isDocumentEdited vs. -updateChangeCount:
- From: Jerry Krinock <email@hidden>
- Date: Mon, 18 Jan 2010 22:58:16 -0800
On 2010 Jan 18, at 09:14, Jerry Krinock wrote:
> - (BOOL)isDocumentEdited
> {
> return (_changeCount > 0) ;
> }
>
> Am I correct?
No, I was wrong. After getting the ivar offset from otool, I poked around with gdb and found that _changeCount can actually be negative. This occurs if you do several edits, save the document, then start Undoing. Exactly as specified by -updateChangeCount documentation, the _changeCount decrements, to -1, -2, etc.
The behavior does seem to be
- (BOOL)isDocumentEdited
{
return (_changeCount != 0) ;
}
I also confirmed another undocumented fact that I suspected, which is that sending -updateChangeCount:NSChangeRedone causes changeCount to increment.
_______________________________________________
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