how to make certain undo registrations not mark the document as edited

Hi. I thought the purpose of UndoManager.setActionIsDiscardable() was for this purpose - but the document still shows as edited.

These changes like changing the zoom/viewing area should not cause the document to be considered edited - but you'd still like to be able to undo them.

The documentation here https://developer.apple.com/documentation/foundation/undomanager/1415261-undoactionisdiscardable?changes=_6 even describes using it for just this purpose.

If this isn't the method, how can I do this? Thanks.

Answered by robaho in 829749022

I was able to solve this by overriding NSDocument

    override func updateChangeCount(_ change: NSDocument.ChangeType) {
        if change.rawValue & NSDocument.ChangeType.changeDiscardable.rawValue != 0 {
            return
        }
        super.updateChangeCount(change)
    }
Accepted Answer

I was able to solve this by overriding NSDocument

    override func updateChangeCount(_ change: NSDocument.ChangeType) {
        if change.rawValue & NSDocument.ChangeType.changeDiscardable.rawValue != 0 {
            return
        }
        super.updateChangeCount(change)
    }
how to make certain undo registrations not mark the document as edited
 
 
Q