In your case, the changes in your text view don't go to the undo stack
Only the last changes, all previous other changes do as expected.
save the document as needed
That is what I'm wondering about. What is the correct way of nudging the undo mechanism so that autosaving would see the document as dirty? We already saw that simply calling updateChangeCount(_:) breaks the undo mechanism.
though AppKit folks may see the current behavior, which skips the save for a clean document when terminating the app, as correct
Skipping save for a clean document is correct in my opinion as well, but the problem is that the document should not be clean in this case, and the question is how it should correctly be marked as dirty without breaking the undo mechanism. The text view probably has an open undo group (waiting for more text to be inserted) that should be closed when trying to quit the app, so that the document is then correctly marked as dirty.
Topic:
UI Frameworks
SubTopic:
AppKit
Tags: