When Buffer's path changes, stop listening for events on former path

This commit is contained in:
Corey Johnson
2012-06-28 13:04:36 -07:00
parent 8e7a8836cd
commit 3dd9253bc5
2 changed files with 21 additions and 0 deletions

View File

@@ -35,6 +35,7 @@ class Buffer
null
setPath: (path) ->
@file?.off()
@file = new File(path)
@file.on "contents-change", =>
@setText(fs.read(@file.getPath())) unless @isModified()