Make Pane close the current item when handling 'core:close' event

This commit is contained in:
Nathan Sobo
2013-02-21 11:13:10 -07:00
committed by probablycorey
parent 11a702a2a6
commit bd8ec81b1e
2 changed files with 10 additions and 0 deletions

View File

@@ -20,6 +20,7 @@ class Pane extends View
@viewsByClassName = {}
@showItem(@items[0])
@command 'core:close', @removeCurrentItem
@command 'pane:show-next-item', @showNextItem
@command 'pane:show-previous-item', @showPreviousItem
@command 'pane:split-left', => @splitLeft()
@@ -65,6 +66,9 @@ class Pane extends View
@items.splice(@getCurrentItemIndex() + 1, 0, item)
item
removeCurrentItem: =>
@removeItem(@currentItem)
removeItem: (item) ->
@showNextItem() if item is @currentItem and @items.length > 1
_.remove(@items, item)