 
   scrollToBottom: ->
     @renderResults(renderAll: true)
-
     super()
-
-    @find('.selected').removeClass('selected')
-    lastPath = @find('.path:last')
-    lastPath.find('.search-result:last').addClass('selected')
 
   scrollToTop: ->
     super()
-
-    @find('.selected').removeClass('selected')
-    @find('.path:first').addClass('selected')
 
   getResultView: (filePath) ->
     el = @find("[data-path=\"#{_.escapeAttribute(filePath)}\"]")

    @prop('scrollHeight') <= @height() + @pixelOverdraw or @prop('scrollHeight') <= @scrollBottom() + @pixelOverdraw

  selectFirstResult: ->
    @find('.selected').removeClass('selected')

    lastView = @find('.search-result:first')
    parentView = lastView.closest('.path')
    if parentView.hasClass('collapsed')
      parentView.addClass('selected')
    else
      lastView.addClass('selected')

    @scrollTop(0)

  selectLastResult: ->
    @find('.selected').removeClass('selected')

    lastView = @find('.search-result:last')
    parentView = lastView.closest('.path')
    if parentView.hasClass('collapsed')
      @scrollTo(parentView.addClass('selected'))
    else
      @scrollTo(lastView.addClass('selected'))

  selectNextResult: ->
    selectedView = @find('.selected').view()

      prevView.addClass('selected')
      @scrollTo(prevView)

  selectResult: (resultView) ->
    @find('.selected').removeClass('selected')

    isPath = resultView.hasClass('path')
    if isPath and not resultView.hasClass('collapsed')
      resultView = resultView.find('.search-result:first')
    else if not isPath
      parentView = resultView.closest('.path')
      resultView = parentView if parentView.hasClass('collapsed')

    resultView.addClass('selected')

  collapseResult: ->
    parent = @find('.selected').closest('.path').view()
    parent.expand(false) if parent instanceof ResultView
