       @setItems(@provider.filterItems(items, words))
 
   observeInputChange: ->
-    buffer = @editor.getBuffer()
+    buffer = @narrowEditor.getBuffer()
     buffer.onDidChange ({newRange}) =>
       if newRange.start.row is 0
         @refresh()


  setGutterMarkerToRow: (row) ->
    @gutterMarker?.destroy()
    @gutterMarker = @editor.markBufferPosition([row, 0])
    @gutter.decorateMarker @gutterMarker,
      class: "narrow-ui-row"
      item: @getGutterItem()

  start: (@provider) ->
    if @provider.constructor.name is 'Search'
      includeHeaderRules = true
    @grammar = new NarrowGrammar(@narrowEditor, {@initialKeyword, includeHeaderRules})
    @grammar.activate()

    activePane = atom.workspace.getActivePane()
    direction = settings.get('directionToOpen')
    if direction is 'here'
      @pane = activePane.activateItem(@narrowEditor)
      @autoPreview = false
    else
      @pane = openItemInAdjacentPaneForPane(activePane, @narrowEditor, direction)
      defaultAutoPreviewConfigName = @provider.getName() + "DefaultAutoPreview"
      @autoPreview = settings.get(defaultAutoPreviewConfigName) ? false

    @getItems().then (items) =>
      @setItems(items)
      if @initialInput
        @narrowEditor.insertText(@initialInput)

  getNarrowQuery: ->
    @narrowEditor.lineTextForBufferRow(0)

  refresh: ->
    query = @getNarrowQuery()
