According to documentation it's enough to override NSResponder.undoManager
to provide custom NSUndoManager
instance. I found it's not quite working:
- Xcode Mac application template comes with Undo menu item bind to
firstResponder.undo:
despiteNSResponder
has noundo:
selector defined. Unless first responder actually respond toundo:
the Undo action doesn't work - NSFirstResponder.undoManager look up in responder chain and eventually it end up in NSWindow where the only place (that I found) that validate Undo menu item is
NSWindow.validateUserInterfaceItem
- that one, as turned out, only ever validateundo:
action if first responder implements_getUndoManager:
selector (quite private, isn't it?) - see attached disassembly
at this point 🤕 I start to think it's either documentation issue, or AppKit implementation issue. Anyway, I didn't found way to enable undo:
action unless I implement one of these methods in my NSView
. (notice: the view is first responder tha