From 24edad10f389992ac079cac4593a5588f600b8ae Mon Sep 17 00:00:00 2001 From: PJ Date: Fri, 5 Sep 2014 19:54:46 -0400 Subject: [PATCH] added functionality to create new pane when trying to move to non-existent pane --- lib/layout-manager.coffee | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/lib/layout-manager.coffee b/lib/layout-manager.coffee index 7bcd87a..05126ca 100644 --- a/lib/layout-manager.coffee +++ b/lib/layout-manager.coffee @@ -47,10 +47,18 @@ module.exports = move: (orientation, delta) -> pane = atom.workspace.getActivePane() [axis,child] = @getAxis pane, orientation - if axis? - target = @getRelativePane axis, child, delta + splitNewPane = false + + if !axis + newPaneDirection = if orientation == 'horizontal' then delta == 1 && 'right' || 'left' else delta == 1 && 'up' || 'down' + atom.workspaceView.getActivePane().trigger 'pane:split-' + newPaneDirection + [axis, child] = @getAxis pane, orientation + splitNewPane = true + target = @getRelativePane axis, child, delta if target? @swapEditor pane, target + if splitNewPane + target.removeItem target.getActiveItem() swapEditor: (source, target) -> editor = source.getActiveItem() @@ -63,7 +71,7 @@ module.exports = axis = pane.parent child = pane while true - return unless axis.constructor.name == 'PaneAxis' + return [null, null] unless axis.constructor.name == 'PaneAxis' break if axis.orientation == orientation child = axis axis = axis.parent