Merge pull request #1878 from atom/ks-mutate-selected-text-public

Make Editor::mutateSelectedText public
This commit is contained in:
Kevin Sawicki
2014-04-17 18:31:42 -07:00

View File

@@ -1002,6 +1002,12 @@ class Editor extends Model
deprecate("Use Editor::duplicateLines() instead")
@duplicateLines()
# Public: Mutate the text of all the selections in a single transaction.
#
# All the changes made inside the given {Function} can be reverted with a
# single call to {::undo}.
#
# fn - A {Function} that will be called with each {Selection}.
mutateSelectedText: (fn) ->
@transact => fn(selection) for selection in @getSelections()