Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions Sources/CodeEditTextView/Utils/CEUndoManager.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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
Expand Down