mirror of
https://github.com/atom/atom.git
synced 2026-04-28 03:01:47 -04:00
Add up/down split options when opening uri in a workspace
This commit is contained in:
@@ -678,6 +678,30 @@ class Pane extends Model
|
||||
else
|
||||
@splitRight()
|
||||
|
||||
# If the parent is a vertical axis, returns its first child if it is a pane;
|
||||
# otherwise returns this pane.
|
||||
findTopmostSibling: ->
|
||||
if @parent.orientation is 'vertical'
|
||||
[topmostSibling] = @parent.children
|
||||
if topmostSibling instanceof PaneAxis
|
||||
this
|
||||
else
|
||||
topmostSibling
|
||||
else
|
||||
this
|
||||
|
||||
# If the parent is a vertical axis, returns its last child if it is a pane;
|
||||
# otherwise returns a new pane created by splitting this pane bottomward.
|
||||
findOrCreateBottommostSibling: ->
|
||||
if @parent.orientation is 'vertical'
|
||||
bottommostSibling = last(@parent.children)
|
||||
if bottommostSibling instanceof PaneAxis
|
||||
@splitRight()
|
||||
else
|
||||
bottommostSibling
|
||||
else
|
||||
@splitDown()
|
||||
|
||||
close: ->
|
||||
@destroy() if @confirmClose()
|
||||
|
||||
|
||||
@@ -361,9 +361,11 @@ class Workspace extends Model
|
||||
# initially. Defaults to `0`.
|
||||
# * `initialColumn` A {Number} indicating which column to move the cursor to
|
||||
# initially. Defaults to `0`.
|
||||
# * `split` Either 'left' or 'right'. If 'left', the item will be opened in
|
||||
# leftmost pane of the current active pane's row. If 'right', the
|
||||
# item will be opened in the rightmost pane of the current active pane's row.
|
||||
# * `split` Either 'left', 'right', 'top' or 'bottom'.
|
||||
# If 'left', the item will be opened in leftmost pane of the current active pane's row.
|
||||
# If 'right', the item will be opened in the rightmost pane of the current active pane's row.
|
||||
# If 'up', the item will be opened in topmost pane of the current active pane's row.
|
||||
# If 'down', the item will be opened in the bottommost pane of the current active pane's row.
|
||||
# * `activatePane` A {Boolean} indicating whether to call {Pane::activate} on
|
||||
# containing pane. Defaults to `true`.
|
||||
# * `searchAllPanes` A {Boolean}. If `true`, the workspace will attempt to
|
||||
@@ -383,6 +385,10 @@ class Workspace extends Model
|
||||
@getActivePane().findLeftmostSibling()
|
||||
when 'right'
|
||||
@getActivePane().findOrCreateRightmostSibling()
|
||||
when 'up'
|
||||
@getActivePane().findTopmostSibling()
|
||||
when 'down'
|
||||
@getActivePane().findOrCreateBottommostSibling()
|
||||
else
|
||||
@getActivePane()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user