mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Clear goal range when selection is modified
Just like the cursor clears its goal column when it is moved in any way other than vertically, the selection clears its goal range (the range it will attempt to use when adding a selection below) when it is changed in any way.
This commit is contained in:
@@ -88,6 +88,7 @@ class Cursor
|
||||
|
||||
clearSelection: ->
|
||||
if @selection
|
||||
@selection.goalBufferRange = null
|
||||
@selection.clear() unless @selection.retainSelection
|
||||
|
||||
getScreenRow: ->
|
||||
|
||||
@@ -591,7 +591,7 @@ class EditSession
|
||||
selection = new Selection(_.extend({editSession: this, marker, cursor}, options))
|
||||
@selections.push(selection)
|
||||
selectionBufferRange = selection.getBufferRange()
|
||||
@mergeIntersectingSelections()
|
||||
@mergeIntersectingSelections() unless options.suppressMerge
|
||||
if selection.destroyed
|
||||
for selection in @getSelections()
|
||||
if selection.intersectsBufferRange(selectionBufferRange)
|
||||
|
||||
@@ -156,7 +156,7 @@ class Selection
|
||||
range = (@goalBufferRange ? @getBufferRange()).copy()
|
||||
range.start.row++
|
||||
range.end.row++
|
||||
@editSession.addSelectionForBufferRange(range, goalBufferRange: range)
|
||||
@editSession.addSelectionForBufferRange(range, goalBufferRange: range, suppressMerge: true)
|
||||
|
||||
insertText: (text, options={}) ->
|
||||
oldBufferRange = @getBufferRange()
|
||||
|
||||
Reference in New Issue
Block a user