     @handleEvents()
     @setCurrentBuffer @editor.getBuffer()
 
+    @compositeDisposable.add atom.workspace.observeActivePaneItem(@updateCurrentEditor)
+
     @compositeDisposable.add atom.commands.add 'atom-text-editor',
       "autocomplete-plus:activate": @runAutocompletion
 

      "autocomplete-plus:select-next": @selectNext,
      "autocomplete-plus:select-previous": @selectPrevious,
      "autocomplete-plus:cancel": @cancel

  confirmSelection: =>
    @emitter.emit 'do-confirm-selection'

    @editor.insertText(match.word)
    @editor.setSelectedBufferRanges(newSelectedBufferRanges)

  # Private: Sets the current buffer, starts listening to change events and delegates
  # them to #onChanged()
  #
