mirror of
https://github.com/atom/atom.git
synced 2026-02-09 14:15:24 -05:00
Maintain selection directionality when merging selections with keyboard
This commit is contained in:
@@ -49,11 +49,11 @@ class CompositeSeleciton
|
||||
|
||||
selectLeft: ->
|
||||
selection.selectLeft() for selection in @getSelections()
|
||||
@mergeIntersectingSelections()
|
||||
@mergeIntersectingSelections reverse: true
|
||||
|
||||
selectUp: ->
|
||||
selection.selectUp() for selection in @getSelections()
|
||||
@mergeIntersectingSelections()
|
||||
@mergeIntersectingSelections reverse: true
|
||||
|
||||
selectDown: ->
|
||||
selection.selectDown() for selection in @getSelections()
|
||||
@@ -71,14 +71,14 @@ class CompositeSeleciton
|
||||
lastSelection: ->
|
||||
_.last(@selections)
|
||||
|
||||
mergeIntersectingSelections: ->
|
||||
mergeIntersectingSelections: (options) ->
|
||||
for selection in @getSelections()
|
||||
otherSelections = @getSelections()
|
||||
_.remove(otherSelections, selection)
|
||||
for otherSelection in otherSelections
|
||||
if selection.intersectsWith(otherSelection)
|
||||
selection.merge(otherSelection)
|
||||
@mergeIntersectingSelections()
|
||||
selection.merge(otherSelection, options)
|
||||
@mergeIntersectingSelections(options)
|
||||
return
|
||||
|
||||
modifySelectedText: (fn) ->
|
||||
|
||||
@@ -139,11 +139,14 @@ class Selection extends View
|
||||
isEmpty: ->
|
||||
@getBufferRange().isEmpty()
|
||||
|
||||
isReversed: ->
|
||||
@cursor.getBufferPosition().isLessThan(@anchorBufferPosition)
|
||||
|
||||
intersectsWith: (otherSelection) ->
|
||||
@getScreenRange().intersectsWith(otherSelection.getScreenRange())
|
||||
|
||||
merge: (otherSelection) ->
|
||||
@setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()))
|
||||
merge: (otherSelection, options) ->
|
||||
@setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options)
|
||||
otherSelection.remove()
|
||||
|
||||
remove: ->
|
||||
|
||||
Reference in New Issue
Block a user