       return if textChanged
       @updateGutter(newBufferPosition)
       if @isAutoPreview() and (oldBufferPosition.row isnt newBufferPosition.row)
-        @confirm(preview: true)
+        @preview()
 
     @editor.getTitle = => ["Narrow", @provider?.getTitle()].join(' ')
     @editor.isModified = -> false

    @clearBlockDecorations()
    query = @getNarrowQuery()
    words = _.compact(query.split(/\s+/))
    filterKey = @provider.getFilterKey()

    @getItems().then (items) =>
      patterns = []
      for word in words
        pattern = _.escapeRegExp(word)
        patterns.push(pattern)

        items = _.filter items, (item) ->
          if filterKey of item
            item[filterKey].match(///#{pattern}///i)
          else
            # When item has no filterKey, it is special, always displayed.
            true

      @updateGrammar(@editor, patterns.join('|'))
      @clearText()
      @setItems(items)
      @updateGutter(@editor.getCursorBufferPosition())

  addBlockDecorationForBufferRow: (row, item) ->
    @blockDecorations ?= []

  registerCommands: ->
    atom.commands.add @editorElement,
      'core:confirm': => @confirm()
      'narrow-ui:preview-item': => @preview()
      'narrow-ui:toggle-auto-preview': => @toggleAutoPreview()
      # 'core:cancel': => @refresh()

  isAutoPreview: -> @autoPreview
  toggleAutoPreview: ->
    if @autoPreview = not @autoPreview
      @preview()

  getItems: ->
    Promise.resolve(@provider.getItems())
