mirror of
https://github.com/atom/atom.git
synced 2026-01-23 13:58:08 -05:00
Use new marker attribute API to store/replicate selection goal ranges
This commit is contained in:
@@ -144,6 +144,9 @@ class DisplayBufferMarker
|
||||
getAttributes: ->
|
||||
@bufferMarker.getAttributes()
|
||||
|
||||
setAttributes: (attributes) ->
|
||||
@bufferMarker.setAttributes(attributes)
|
||||
|
||||
matchesAttributes: (attributes) ->
|
||||
@bufferMarker.matchesAttributes(attributes)
|
||||
|
||||
|
||||
@@ -108,7 +108,7 @@ class Selection
|
||||
|
||||
# Clears the selection, moving the marker to move to the head.
|
||||
clear: ->
|
||||
@setGoalBufferRange(null)
|
||||
@marker.setAttributes(goalBufferRange: null)
|
||||
@marker.clearTail() unless @retainSelection
|
||||
|
||||
# Modifies the selection to mark the current word.
|
||||
@@ -232,9 +232,6 @@ class Selection
|
||||
getGoalBufferRange: ->
|
||||
@marker.getAttributes().goalBufferRange
|
||||
|
||||
setGoalBufferRange: (goalBufferRange) ->
|
||||
@marker.getAttributes().goalBufferRange = goalBufferRange
|
||||
|
||||
# Moves the selection up one row.
|
||||
addSelectionAbove: ->
|
||||
range = (@getGoalBufferRange() ? @getBufferRange()).copy()
|
||||
@@ -514,14 +511,13 @@ class Selection
|
||||
# otherSelection - A `Selection` to merge with
|
||||
# options - A hash of options matching those found in {.setBufferRange}
|
||||
merge: (otherSelection, options) ->
|
||||
@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options)
|
||||
|
||||
myGoalBufferRange = @getGoalBufferRange()
|
||||
otherGoalBufferRange = otherSelection.getGoalBufferRange()
|
||||
if myGoalBufferRange? and otherGoalBufferRange?
|
||||
@setGoalBufferRange(myGoalBufferRange.union(otherGoalBufferRange))
|
||||
else if otherGoalBufferRange
|
||||
@setGoalBufferRange(otherGoalBufferRange)
|
||||
options.goalBufferRange = myGoalBufferRange.union(otherGoalBufferRange)
|
||||
else
|
||||
options.goalBufferRange = myGoalBufferRange ? otherGoalBufferRange
|
||||
@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options)
|
||||
otherSelection.destroy()
|
||||
|
||||
### Internal ###
|
||||
|
||||
2
vendor/telepath
vendored
2
vendor/telepath
vendored
Submodule vendor/telepath updated: 8337309f31...c25fa296d0
Reference in New Issue
Block a user