diff --git a/Sources/CodeEditTextView/Utils/CEUndoManager.swift b/Sources/CodeEditTextView/Utils/CEUndoManager.swift index e9ce1223..c716d49b 100644 --- a/Sources/CodeEditTextView/Utils/CEUndoManager.swift +++ b/Sources/CodeEditTextView/Utils/CEUndoManager.swift @@ -40,6 +40,14 @@ public class CEUndoManager { parent?.redo() } + public override func beginUndoGrouping() { + parent?.beginUndoGrouping() + } + + public override func endUndoGrouping() { + parent?.endUndoGrouping() + } + public override func registerUndo(withTarget target: Any, selector: Selector, object anObject: Any?) { // no-op, but just in case to save resources: removeAllActions() @@ -164,18 +172,18 @@ public class CEUndoManager { // MARK: - Grouping /// Groups all incoming mutations. - public func beginGrouping() { + public func beginUndoGrouping() { guard !isGrouping else { - assertionFailure("UndoManager already in a group. Call `endGrouping` before this can be called.") + assertionFailure("UndoManager already in a group. Call `beginUndoGrouping` before this can be called.") return } isGrouping = true } /// Stops grouping all incoming mutations. - public func endGrouping() { + public func endUndoGrouping() { guard isGrouping else { - assertionFailure("UndoManager not in a group. Call `beginGrouping` before this can be called.") + assertionFailure("UndoManager not in a group. Call `endUndoGrouping` before this can be called.") return } isGrouping = false