mirror of
https://github.com/atom/atom.git
synced 2026-02-16 01:25:13 -05:00
Guard against PaneAxis as first child
Pane::findLeftmostSibling expected to return a Pane, not a PaneAxis
This commit is contained in:
@@ -339,15 +339,19 @@ class Pane extends Model
|
||||
newPane.activate()
|
||||
newPane
|
||||
|
||||
# If the parent is a horizontal axis, returns its first child;
|
||||
# otherwise this pane.
|
||||
# If the parent is a horizontal axis, returns its first child if it is a pane;
|
||||
# otherwise returns this pane.
|
||||
findLeftmostSibling: ->
|
||||
if @parent.orientation is 'horizontal'
|
||||
@parent.children[0]
|
||||
[leftmostSibling] = @parent.children
|
||||
if leftmostSibling instanceof PaneAxis
|
||||
this
|
||||
else
|
||||
leftmostSibling
|
||||
else
|
||||
this
|
||||
|
||||
# If the parent is a horizontal axis, returns its last child;
|
||||
# If the parent is a horizontal axis, returns its last child if it is a pane;
|
||||
# otherwise returns a new pane created by splitting this pane rightward.
|
||||
findOrCreateRightmostSibling: ->
|
||||
if @parent.orientation is 'horizontal'
|
||||
|
||||
Reference in New Issue
Block a user