mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-09-20 23:48:05 +03:00
Use buffer ranges when merging selections
This commit is contained in:
parent
0a23a21953
commit
6633c90af8
@ -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, 4]]])
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 4]]]
|
||||
editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 0], [5, 5]]])
|
||||
expect(editor.getSelectedBufferRanges()).toEqual [[[2, 2], [5, 5]]]
|
||||
|
||||
it "does not merge non-empty adjacent selections", ->
|
||||
editor.setSelectedBufferRanges([[[2, 2], [3, 3]], [[3, 3], [5, 5]]])
|
||||
|
@ -695,7 +695,7 @@ class Selection extends Model
|
||||
# the given selection.
|
||||
#
|
||||
# * `otherSelection` A {Selection} to merge with.
|
||||
# * `options` (optional) {Object} options matching those found in {::setScreenRange}.
|
||||
# * `options` (optional) {Object} options matching those found in {::setBufferRange}.
|
||||
merge: (otherSelection, options) ->
|
||||
myGoalScreenRange = @getGoalScreenRange()
|
||||
otherGoalScreenRange = otherSelection.getGoalScreenRange()
|
||||
@ -705,7 +705,7 @@ class Selection extends Model
|
||||
else
|
||||
options.goalScreenRange = myGoalScreenRange ? otherGoalScreenRange
|
||||
|
||||
@setScreenRange(@getScreenRange().union(otherSelection.getScreenRange()), options)
|
||||
@setBufferRange(@getBufferRange().union(otherSelection.getBufferRange()), options)
|
||||
otherSelection.destroy()
|
||||
|
||||
###
|
||||
|
Loading…
Reference in New Issue
Block a user