Allow for more than one empty buffer to be open

Closes #679
This commit is contained in:
Ben Ogle 2013-09-23 17:27:41 -07:00
parent ef3ccc992b
commit 87fb07e657
2 changed files with 7 additions and 1 deletions

View File

@ -212,6 +212,11 @@ describe "RootView", ->
expect(editSession.getPath()).toBeUndefined()
expect(rootView.getActivePane().focus).toHaveBeenCalled()
it "can create multiple empty edit sessions as an item on a new pane", ->
editSession = rootView.open()
editSession = rootView.open()
expect(rootView.getActivePane().getItems().length).toBe 2
describe "when called with a path", ->
it "creates an edit session for the given path as an item on a new pane, and focuses the pane", ->
editSession = rootView.open('b')

View File

@ -173,7 +173,8 @@ class RootView extends View
initialLine = options.initialLine
path = project.relativize(path)
if activePane = @getActivePane()
editSession = activePane.itemForUri(path) ? project.open(path, {initialLine})
editSession = activePane.itemForUri(path)
editSession = project.open(path, {initialLine}) unless path and editSession
activePane.showItem(editSession)
else
editSession = project.open(path, {initialLine})