Skip to content

Commit

Permalink
Make sure to end undo group (#3)
Browse files Browse the repository at this point in the history
  • Loading branch information
krzyzanowskim authored Sep 18, 2023
1 parent 10810f3 commit c92768d
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Sources/TextFormationPlugin/TextFormationPlugin.swift
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ public struct TextFormationPlugin: STPlugin {
let mutation = TextMutation(string: string, range: range, limit: limit)

textView.undoManager?.beginUndoGrouping()
defer {
textView.undoManager?.endUndoGrouping()
}

for filter in filters {
switch filter.processMutation(mutation, in: adapter, with: whitespaceProviders) {
Expand All @@ -78,8 +81,6 @@ public struct TextFormationPlugin: STPlugin {
}
}

textView.undoManager?.endUndoGrouping()

return true
}
}
Expand Down

0 comments on commit c92768d

Please sign in to comment.