     @needsAutoscroll = options.autoscroll
     options.reversed ?= @isReversed()
     @editor.destroyFoldsIntersectingBufferRange(bufferRange) unless options.preserveFolds
+    @updateDecoration(options)
     @modifySelection =>
       @cursor.needsAutoscroll = false if @needsAutoscroll?
       @marker.setBufferRange(bufferRange, options)

  constructor: ({@cursor, @marker, @editor, id}) ->
    @assignId(id)
    @cursor.selection = this
    @addDecoration()

    @marker.on 'changed', => @screenRangeChanged()
    @marker.bufferMarker.on 'changed', (e) => @markerChanged(e)
    @marker.on 'destroyed', =>
      @destroyed = true
      @editor.removeSelection(this)

  compare: (otherSelection) ->
    @getBufferRange().compare(otherSelection.getBufferRange())

  addDecoration: ({highlighted})->
    @delayUnhighlight() if highlighted

    @decoration = {type: 'highlight', class: @getDecorationClass(highlighted)}
    @editor.addDecorationForMarker(@marker, @decoration)

  updateDecoration: ({highlighted}) ->
    @delayUnhighlight() if highlighted

    newDecoration = {type: 'highlight', class: @getDecorationClass(highlighted)}
    @editor.updateDecorationForMarker(@marker, @decoration, newDecoration)
    @decoration = newDecoration

  delayUnhighlight: ->
    @unhighlight()
    @unhighlightTimeout = setTimeout((=> @unhighlight()), 1000)

  highlight: ->
    @updateDecoration(highlighted: true)

  unhighlight: ->
    @updateDecoration(highlighted: false)
    clearTimeout(@unhighlightTimeout)

  getDecorationClass: (highlighted) ->
    klass = 'selection'
    klass += ' highlighted' if highlighted
    klass

  screenRangeChanged: ->
    screenRange = @getScreenRange()
    @emit 'screen-range-changed', screenRange
    @editor.selectionScreenRangeChanged(this)
