mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
🎨 Get rid of goalBufferRange
This commit is contained in:
@@ -1456,8 +1456,8 @@ describe "TextEditor", ->
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[5, 5], [6, 6]]]
|
||||
|
||||
it "merges intersecting selections", ->
|
||||
editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]])
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]]
|
||||
editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 4]]])
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 4]]]
|
||||
|
||||
it "does not merge non-empty adjacent selections", ->
|
||||
editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 3], [5, 5]]])
|
||||
|
||||
@@ -183,7 +183,7 @@ class Selection extends Model
|
||||
|
||||
# Public: Clears the selection, moving the marker to the head.
|
||||
clear: ->
|
||||
@marker.setProperties(goalBufferRange: null, goalScreenRange: null)
|
||||
@marker.setProperties(goalScreenRange: null)
|
||||
@marker.clearTail() unless @retainSelection
|
||||
@finalize()
|
||||
|
||||
@@ -695,15 +695,17 @@ class Selection extends Model
|
||||
# the given selection.
|
||||
#
|
||||
# * `otherSelection` A {Selection} to merge with.
|
||||
# * `options` (optional) {Object} options matching those found in {::setBufferRange}.
|
||||
# * `options` (optional) {Object} options matching those found in {::setScreenRange}.
|
||||
merge: (otherSelection, options) ->
|
||||
myGoalBufferRange = @getGoalBufferRange()
|
||||
otherGoalBufferRange = otherSelection.getGoalBufferRange()
|
||||
if myGoalBufferRange? and otherGoalBufferRange?
|
||||
options.goalBufferRange = myGoalBufferRange.union(otherGoalBufferRange)
|
||||
myGoalScreenRange = @getGoalScreenRange()
|
||||
otherGoalScreenRange = otherSelection.getGoalScreenRange()
|
||||
|
||||
if myGoalScreenRange? and otherGoalScreenRange?
|
||||
options.goalScreenRange = myGoalScreenRange.union(otherGoalScreenRange)
|
||||
else
|
||||
options.goalBufferRange = myGoalBufferRange ? otherGoalBufferRange
|
||||
@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options)
|
||||
options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange
|
||||
|
||||
@setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options)
|
||||
otherSelection.destroy()
|
||||
|
||||
###
|
||||
@@ -764,10 +766,6 @@ class Selection extends Model
|
||||
plantTail: ->
|
||||
@marker.plantTail()
|
||||
|
||||
getGoalBufferRange: ->
|
||||
if goalBufferRange = @marker.getProperties().goalBufferRange
|
||||
Range.fromObject(goalBufferRange)
|
||||
|
||||
getGoalScreenRange: ->
|
||||
if goalScreenRange = @marker.getProperties().goalScreenRange
|
||||
Range.fromObject(goalScreenRange)
|
||||
|
||||
Reference in New Issue
Block a user