From c638c23e3ff8c38a09110e04082a2cd5e36a45bc Mon Sep 17 00:00:00 2001 From: Antonio Scandurra Date: Thu, 26 Feb 2015 18:27:08 +0100 Subject: [PATCH] :racehorse: One `mergeIntersectingSelections` per text mutation * Return fn value from `mergeIntersectingSelections` if supplied --- src/text-editor.coffee | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/text-editor.coffee b/src/text-editor.coffee index 0de8ecdae..03ae19d5b 100644 --- a/src/text-editor.coffee +++ b/src/text-editor.coffee @@ -836,7 +836,8 @@ class TextEditor extends Model # argument will be a {Selection} and the second argument will be the # {Number} index of that selection. mutateSelectedText: (fn) -> - @transact => fn(selection, index) for selection, index in @getSelections() + @mergeIntersectingSelections => + @transact => fn(selection, index) for selection, index in @getSelections() # Move lines intersection the most recent selection up by one row in screen # coordinates. @@ -2248,6 +2249,7 @@ class TextEditor extends Model [head, tail...] = @getSelectionsOrderedByBufferPosition() _.reduce(tail, reducer, [head]) + return result if fn? # Add a {Selection} based on the given {Marker}. #