mirror of
https://github.com/pulsar-edit/pulsar.git
synced 2024-11-10 10:17:11 +03:00
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:
parent
3b52a6a040
commit
621058aa9e
@ -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 ->
|
||||
|
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user