mirror of
https://github.com/atom/atom.git
synced 2026-02-14 08:35:11 -05:00
When showing an item on a pane, add it to the items list if needed
This commit is contained in:
committed by
probablycorey
parent
41f18ee6a2
commit
d89a7eb522
@@ -47,6 +47,7 @@ class Pane extends View
|
||||
@showItem(@items[index])
|
||||
|
||||
showItem: (item) ->
|
||||
@addItem(item)
|
||||
@itemViews.children().hide()
|
||||
view = @viewForItem(item)
|
||||
unless view.parent().is(@itemViews)
|
||||
@@ -54,6 +55,11 @@ class Pane extends View
|
||||
@currentItem = item
|
||||
view.show()
|
||||
|
||||
addItem: (item) ->
|
||||
return if _.include(@items, item)
|
||||
@items.splice(@getCurrentItemIndex() + 1, 0, item)
|
||||
item
|
||||
|
||||
removeItem: (item) ->
|
||||
@showNextItem() if item is @currentItem and @items.length > 1
|
||||
_.remove(@items, item)
|
||||
|
||||
Reference in New Issue
Block a user