mirror of
https://github.com/atom/atom.git
synced 2026-04-06 03:02:13 -04:00
Editor selects text that was typed at a tab-stop when shift-tabbing back to it
This commit is contained in:
@@ -7,7 +7,7 @@ class AnchorRange
|
||||
|
||||
constructor: (@editSession, bufferRange) ->
|
||||
bufferRange = Range.fromObject(bufferRange)
|
||||
@startAnchor = @editSession.addAnchorAtBufferPosition(bufferRange.start)
|
||||
@startAnchor = @editSession.addAnchorAtBufferPosition(bufferRange.start, ignoreEqual: true)
|
||||
@endAnchor = @editSession.addAnchorAtBufferPosition(bufferRange.end)
|
||||
|
||||
getBufferRange: ->
|
||||
@@ -18,4 +18,4 @@ class AnchorRange
|
||||
|
||||
destroy: ->
|
||||
@startAnchor.destroy()
|
||||
@endAnchor.destroy()
|
||||
@endAnchor.destroy()
|
||||
|
||||
@@ -8,12 +8,17 @@ class Anchor
|
||||
bufferPosition: null
|
||||
screenPosition: null
|
||||
|
||||
constructor: (@editSession) ->
|
||||
constructor: (@editSession, options = {}) ->
|
||||
{ @ignoreEqual } = options
|
||||
|
||||
handleBufferChange: (e) ->
|
||||
{ oldRange, newRange } = e
|
||||
position = @getBufferPosition()
|
||||
return if position.isLessThan(oldRange.end)
|
||||
|
||||
if @ignoreEqual
|
||||
return if position.isLessThanOrEqual(oldRange.end)
|
||||
else
|
||||
return if position.isLessThan(oldRange.end)
|
||||
|
||||
newRow = newRange.end.row
|
||||
newColumn = newRange.end.column
|
||||
|
||||
@@ -237,13 +237,13 @@ class EditSession
|
||||
getAnchors: ->
|
||||
new Array(@anchors...)
|
||||
|
||||
addAnchor: ->
|
||||
anchor = new Anchor(this)
|
||||
addAnchor: (options) ->
|
||||
anchor = new Anchor(this, options)
|
||||
@anchors.push(anchor)
|
||||
anchor
|
||||
|
||||
addAnchorAtBufferPosition: (bufferPosition) ->
|
||||
anchor = @addAnchor()
|
||||
addAnchorAtBufferPosition: (bufferPosition, options) ->
|
||||
anchor = @addAnchor(options)
|
||||
anchor.setBufferPosition(bufferPosition)
|
||||
anchor
|
||||
|
||||
|
||||
Reference in New Issue
Block a user