From 87fb07e6575b701c24fa34e85c38137a859ed23b Mon Sep 17 00:00:00 2001 From: Ben Ogle Date: Mon, 23 Sep 2013 17:27:41 -0700 Subject: [PATCH] Allow for more than one empty buffer to be open Closes #679 --- spec/root-view-spec.coffee | 5 +++++ src/root-view.coffee | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/spec/root-view-spec.coffee b/spec/root-view-spec.coffee index 2e7abe220..22db03f69 100644 --- a/spec/root-view-spec.coffee +++ b/spec/root-view-spec.coffee @@ -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') diff --git a/src/root-view.coffee b/src/root-view.coffee index 694f064b7..43a9abfdb 100644 --- a/src/root-view.coffee +++ b/src/root-view.coffee @@ -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})