🐎 One mergeIntersectingSelections per text mutation

* Return fn value from `mergeIntersectingSelections` if supplied
This commit is contained in:
Antonio Scandurra
2015-02-26 18:27:08 +01:00
parent c8fb791343
commit c638c23e3f

View File

@@ -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}.
#