Add 'pane:close' event, which destroys all pane items.

Still have some issues with the presentation order of dialogs with
multiple unsaved buffers and no paths. But for the 99% case this works
as is.
This commit is contained in:
Nathan Sobo
2013-03-01 14:37:46 -07:00
committed by probablycorey
parent da986b6a6c
commit 48c693d756
2 changed files with 13 additions and 0 deletions

View File

@@ -270,6 +270,15 @@ describe "Pane", ->
expect(containerCloseHandler).not.toHaveBeenCalled()
describe "pane:close", ->
it "destroys all items and removes the pane", ->
pane.showItem(editSession1)
initialItemCount = pane.getItems().length
pane.trigger 'pane:close'
expect(pane.hasParent()).toBeFalsy()
expect(editSession2.destroyed).toBeTruthy()
expect(editSession1.destroyed).toBeTruthy()
describe "core:save", ->
describe "when the current item has a path", ->
describe "when the current item has a save method", ->

View File

@@ -30,6 +30,7 @@ class Pane extends View
@command 'pane:split-right', => @splitRight()
@command 'pane:split-up', => @splitUp()
@command 'pane:split-down', => @splitDown()
@command 'pane:close', => @destroyItems()
@on 'focus', => @activeView.focus(); false
@on 'focusin', => @makeActive()
@@ -108,6 +109,9 @@ class Pane extends View
else
reallyDestroyItem()
destroyItems: ->
@destroyItem(item) for item in @getItems()
promptToSaveItem: (item, nextAction) ->
path = item.getPath()
atom.confirm(