RootView emits an 'active-editor-path-change' event whenever the path of the active editor changes for any reason (buffer path change, new buffer opened, focus changes)

This commit is contained in:
Nathan Sobo
2012-04-24 12:50:00 -06:00
parent 3d382955cc
commit 590352b079
2 changed files with 35 additions and 7 deletions

View File

@@ -81,16 +81,16 @@ class RootView extends View
editorFocused: (editor) ->
if @panes.containsElement(editor)
@panes.find('.editor')
.removeClass('active')
.off('.root-view')
previousActiveEditor = @panes.find('.editor.active').view()
previousActiveEditor?.removeClass('active').off('.root-view')
editor
.addClass('active')
.on 'editor-path-change.root-view', =>
@trigger 'active-editor-path-change', editor.buffer.path
@trigger 'active-editor-path-change', editor.buffer.path
if not previousActiveEditor or editor.buffer.path != previousActiveEditor.buffer.path
@trigger 'active-editor-path-change', editor.buffer.path
setTitle: (title='untitled') ->
document.title = title