     @locked = false
 
   observeCursorPositionChange: ->
-    @editor.onDidChangeCursorPosition (event) =>
+    @narrowEditor.onDidChangeCursorPosition (event) =>
       {oldBufferPosition, newBufferPosition, textChanged, cursor} = event
       return if @isLocked() or
         textChanged or


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

  focus: ->
    if @isAlive()
      @pane.activate()
      @pane.activateItem(@narrowEditor)

  isAlive: ->
    @narrowEditor?.isAlive?()

  buildEditor: (params={}) ->
    @narrowEditor = atom.workspace.buildTextEditor(lineNumberGutterVisible: false)
    @gutter = @narrowEditor.addGutter(name: 'narrow')
    @narrowEditor.onDidDestroy => @destroy()

    @narrowEditorElement = @narrowEditor.element
    @narrowEditorElement.classList.add('narrow')
    @narrowEditorElement.classList.add(params.class) if params.class

    @narrowEditor.getTitle = => @provider?.getTitle()
    @narrowEditor.isModified = -> false

  destroy: ->
    @originalPane.activate() if @originalPane.isAlive()
