mirror of
https://github.com/atom/atom.git
synced 2026-02-14 08:35:11 -05:00
Replace stayValid option w/ validationStrategy when creating markers
This commit is contained in:
@@ -8,9 +8,9 @@ class BufferMarker
|
||||
headPosition: null
|
||||
tailPosition: null
|
||||
suppressObserverNotification: false
|
||||
stayValid: false
|
||||
invalidationStrategy: 'contains'
|
||||
|
||||
constructor: ({@id, @buffer, range, @stayValid, noTail, reverse}) ->
|
||||
constructor: ({@id, @buffer, range, @invalidationStrategy, noTail, reverse}) ->
|
||||
@setRange(range, {noTail, reverse})
|
||||
|
||||
setRange: (range, options={}) ->
|
||||
@@ -76,7 +76,7 @@ class BufferMarker
|
||||
containsEnd = oldRange.containsPoint(@getEndPosition(), exclusive: true)
|
||||
return unless containsEnd or containsStart
|
||||
|
||||
if @stayValid
|
||||
if @invalidationStrategy is 'never'
|
||||
previousRange = @getRange()
|
||||
if containsStart and containsEnd
|
||||
@setRange([oldRange.end, oldRange.end])
|
||||
|
||||
@@ -538,11 +538,11 @@ class EditSession
|
||||
_.last(@cursors)
|
||||
|
||||
addCursorAtScreenPosition: (screenPosition) ->
|
||||
marker = @markScreenPosition(screenPosition, stayValid: true)
|
||||
marker = @markScreenPosition(screenPosition, invalidationStrategy: 'never')
|
||||
@addSelection(marker).cursor
|
||||
|
||||
addCursorAtBufferPosition: (bufferPosition) ->
|
||||
marker = @markBufferPosition(bufferPosition, stayValid: true)
|
||||
marker = @markBufferPosition(bufferPosition, invalidationStrategy: 'never')
|
||||
@addSelection(marker).cursor
|
||||
|
||||
addCursor: (marker) ->
|
||||
@@ -565,7 +565,7 @@ class EditSession
|
||||
selection
|
||||
|
||||
addSelectionForBufferRange: (bufferRange, options={}) ->
|
||||
options = _.defaults({stayValid: true}, options)
|
||||
options = _.defaults({invalidationStrategy: 'never'}, options)
|
||||
marker = @markBufferRange(bufferRange, options)
|
||||
@addSelection(marker)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user