Autoscroll to selections in model layer when added

Fixes #2698
This commit is contained in:
Nathan Sobo
2014-06-20 16:53:23 -06:00
parent 6cdb1a188a
commit e084bebb54
2 changed files with 18 additions and 1 deletions

View File

@@ -1278,7 +1278,9 @@ class Editor extends Model
# Returns the added {Selection}.
addSelectionForBufferRange: (bufferRange, options={}) ->
@markBufferRange(bufferRange, _.defaults(@getSelectionMarkerAttributes(), options))
@getLastSelection()
selection = @getLastSelection()
selection.autoscroll()
selection
# Public: Set the selected range in buffer coordinates. If there are multiple
# selections, they are reduced to a single selection with the given range.