Register copied edit sessions on the project

Without this any split edit sessions won't be passed to package
listeners that register using project.eachEditSession()

Closes #1065
This commit is contained in:
Kevin Sawicki 2013-11-01 15:51:27 -07:00
parent 3b52a6a040
commit 621058aa9e
2 changed files with 17 additions and 0 deletions

View File

@ -62,6 +62,22 @@ describe "Project", ->
expect(project.getEditSessions()[0]).toBe editSession1
expect(project.getEditSessions()[1]).toBe editSession2
describe "when an edit session is copied", ->
it "emits an 'edit-session-created' event and stores the edit session", ->
handler = jasmine.createSpy('editSessionCreatedHandler')
project.on 'edit-session-created', handler
editSession1 = project.openSync("a")
expect(handler.callCount).toBe 1
expect(project.getEditSessions().length).toBe 1
expect(project.getEditSessions()[0]).toBe editSession1
editSession2 = editSession1.copy()
expect(handler.callCount).toBe 2
expect(project.getEditSessions().length).toBe 2
expect(project.getEditSessions()[0]).toBe editSession1
expect(project.getEditSessions()[1]).toBe editSession2
describe ".openSync(path)", ->
[fooOpener, barOpener, absolutePath, newBufferHandler, newEditSessionHandler] = []
beforeEach ->

View File

@ -162,6 +162,7 @@ class EditSession
newEditSession.setScrollLeft(@getScrollLeft())
for marker in @findMarkers(editSessionId: @id)
marker.copy(editSessionId: newEditSession.id, preserveFolds: true)
project.addEditSession(newEditSession)
newEditSession
# Public: Retrieves the filename of the open file.