       if @isActive()
         @selectItemForRow(@findRowForNormalItem(0, 'next'))
       @setModifiedState(false)
+      unless @hasItems()
+        @selectedItem = null
+        @previouslySelectedItem = null
+        @rowMarker?.destroy()
+        @rowMarker = null
+
       @emitDidRefresh()
       @emitDidStopRefreshing()
 

  preview: ->
    @preventSyncToEditor = true
    item = @getSelectedItem()
    @provider.openFileForItem(item).then (editor) =>
      editor.scrollToBufferPosition(item.point, center: true)
      @setRowMarker(editor, item.point)

  selectItem: (item) ->
    if (row = @getRowForItem(item)) >= 0
      @selectItemForRow(row)

  hasItems: ->
    @items.length > 1 # ignore prompt placeholder item

  selectItemForRow: (row) ->
    item = @items[row]
