 
   getSelectedItem: ->
     @selectedItem ? {}
-
-  setItems: (items) ->
-    @items = [{_prompt: true, skip: true}, items...]
-    texts = items.map (item) => @provider.viewForItem(item)
-    @appendText(texts.join("\n"))
-    @selectItemForRow(@findNormalItem(1, 'next'))
 
   getPromptRange: ->
     @editor.bufferRangeForBufferRow(0)


  constructor: (@provider, {@input}={}) ->
    @disposables = new CompositeDisposable

    @originalPane = atom.workspace.getActivePane()
    @gutterItem = document.createElement('span')

    query = @getNarrowQuery()
    words = _.compact(query.split(/\s+/))
    regexps = words.map (word) => @getRegExpForQueryWord(word)
    @ignoreChangeOnNarrowEditor = true

    # In case prompt accidentaly mutated
    eof = @editor.getEofBufferPosition()
    if eof.isLessThan(@itemAreaStart)
      eof = @setPromptLine("\n").end
      @moveToPrompt()

    Promise.resolve(@provider.getItems()).then (items) =>
      items = @provider.filterItems(items, regexps)
      @items = [@promptItem, items...]
      @renderItems(items)
      @grammar.update(regexps)
      @selectItemForRow(@findNormalItem(1, 'next'))

      @ignoreChangeOnNarrowEditor = false

  renderItems: (items) ->
    texts = items.map (item) -> @provider.viewForItem(item)
    itemArea = new Range(@itemAreaStart, @editor.getEofBufferPosition())
    range = @editor.setTextInBufferRange(itemArea, texts.join("\n")
    @editorLastRow = range.end.row

  ensureNarrowEditorIsValidState: ->
    # Ensure all item have valid line header
