Created
January 4, 2016 18:33
-
-
Save MattyAyOh/478df3a9cc160fcedcd2 to your computer and use it in GitHub Desktop.
Remove empty undo group
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
id undostack = object_getIvar(undoManager, class_getInstanceVariable([NSUndoManager class], NEVER_TRANSLATE("_undoStack"))); | |
id headAction = object_getIvar(undostack, class_getInstanceVariable([undostack class], NEVER_TRANSLATE("_head"))); | |
id nextAction = object_getIvar(headAction, class_getInstanceVariable([headAction class], NEVER_TRANSLATE("next"))); | |
const char *beginGroupName = NEVER_TRANSLATE("_NSUndoBeginMark"); | |
const char *nextActionName = object_getClassName(nextAction); | |
if( strcmp(beginGroupName,nextActionName) == 0 ) | |
{ | |
[undoManager undo]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment