mirror of
https://github.com/atom/atom.git
synced 2026-01-23 22:08:08 -05:00
Derive PaneView::activeView from the model's activeItem
We're getting into some strange order-sensitive cases where we respond to a change of the active item before the pane has a chance to reassign the active view. Therefore it makes more sense to always just derive the active view from the active item.
This commit is contained in:
@@ -52,7 +52,8 @@
|
||||
"underscore-plus": "0.6.1",
|
||||
"theorist": "~0.13.0",
|
||||
"delegato": "~0.4.0",
|
||||
"mixto": "~0.4.0"
|
||||
"mixto": "~0.4.0",
|
||||
"property-accessors": "~0.1.0"
|
||||
},
|
||||
"packageDependencies": {
|
||||
"atom-dark-syntax": "0.10.0",
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
{$, View} = require './space-pen-extensions'
|
||||
Serializable = require 'serializable'
|
||||
Delegator = require 'delegato'
|
||||
PropertyAccessors = require 'property-accessors'
|
||||
|
||||
Pane = require './pane'
|
||||
|
||||
@@ -14,6 +15,7 @@ module.exports =
|
||||
class PaneView extends View
|
||||
Serializable.includeInto(this)
|
||||
Delegator.includeInto(this)
|
||||
PropertyAccessors.includeInto(this)
|
||||
|
||||
@version: 1
|
||||
|
||||
@@ -152,7 +154,6 @@ class PaneView extends View
|
||||
view.show() if @attached
|
||||
view.focus() if hasFocus
|
||||
|
||||
@activeView = view
|
||||
@trigger 'pane:active-item-changed', [item]
|
||||
|
||||
onItemAdded: (item, index) =>
|
||||
@@ -186,6 +187,7 @@ class PaneView extends View
|
||||
|
||||
# Private:
|
||||
viewForItem: (item) ->
|
||||
return unless item?
|
||||
if item instanceof $
|
||||
item
|
||||
else if view = @viewsByItem.get(item)
|
||||
@@ -197,8 +199,7 @@ class PaneView extends View
|
||||
view
|
||||
|
||||
# Private:
|
||||
viewForActiveItem: ->
|
||||
@viewForItem(@activeItem)
|
||||
@::accessor 'activeView', -> @viewForItem(@activeItem)
|
||||
|
||||
splitLeft: (items...) -> @model.splitLeft({items})._view
|
||||
|
||||
|
||||
Reference in New Issue
Block a user