Remove event handlers when editor is removed

This commit is contained in:
Kevin Sawicki 2013-02-04 18:24:54 -08:00
parent 0270ba3e1c
commit b30fae7a68

View File

@ -21,7 +21,8 @@ class BracketMatcher extends AtomPackage
rootView.eachEditor (editor) => @subscribeToEditor(editor) if editor.attached
subscribeToEditor: (editor) ->
editor.on 'cursor:moved', => @updateMatch(editor)
editor.on 'cursor:moved.bracket-matcher', => @updateMatch(editor)
editor.on 'editor:will-be-removed', => editor.off('.bracket-matcher')
createView: (editor, bufferPosition) ->
pixelPosition = editor.pixelPositionForBufferPosition(bufferPosition)