Inform pane containers directly when adding non-moved pane items

This commit is contained in:
Nathan Sobo 2017-04-06 12:52:42 -06:00
parent ae8d26a8fe
commit 317428b58d
2 changed files with 5 additions and 9 deletions

View File

@ -306,22 +306,16 @@ class PaneContainer {
const iterable = pane.getItems()
for (let index = 0; index < iterable.length; index++) {
const item = iterable[index]
this.addedPaneItem(item, pane, index)
this.didAddPaneItem(item, pane, index)
}
pane.onDidAddItem(({item, index, moved}) => {
if (!moved) { this.addedPaneItem(item, pane, index) }
}
)
pane.onDidRemoveItem(({item, moved}) => {
if (!moved) { this.removedPaneItem(item) }
}
)
})
}))
}
addedPaneItem (item, pane, index) {
didAddPaneItem (item, pane, index) {
this.itemRegistry.addItem(item)
this.emitter.emit('did-add-pane-item', {item, pane, index})
}

View File

@ -500,6 +500,8 @@ class Pane
@setPendingItem(item) if pending
@emitter.emit 'did-add-item', {item, index, moved}
@container?.didAddPaneItem(item, this, index) unless moved
@destroyItem(lastPendingItem) if replacingPendingItem
@setActiveItem(item) unless @getActiveItem()?
item