Trigger buffer-created from Project::addBufferAtIndex

This ensures that any listeners for this event will be notified when
a buffer is add via deserialization from a telepath document.
This commit is contained in:
Kevin Sawicki
2013-09-02 11:46:32 -07:00
parent 91531d53da
commit aaea8bdb31
2 changed files with 21 additions and 1 deletions

View File

@@ -252,7 +252,6 @@ class Project
filePath = @resolve(filePath) if filePath?
buffer = new TextBuffer({project: this, filePath, initialText})
@addBuffer(buffer)
@trigger 'buffer-created', buffer
buffer
# Private:
@@ -263,6 +262,7 @@ class Project
addBufferAtIndex: (buffer, index, options={}) ->
@buffers[index] = buffer
@state.get('buffers').insert(index, buffer.getState()) if options.updateState ? true
@trigger 'buffer-created', buffer
# Private: Removes a {TextBuffer} association from the project.
#