Improve split API, add new commands and rewrite existing ones

Allow empty splits, as well as moving (instead of copying) active item
This commit is contained in:
Aaron Contreras 2015-08-04 01:47:55 +02:00
parent fc6c2d8b5e
commit 500afb0f20
5 changed files with 26 additions and 16 deletions

View File

@ -81,10 +81,10 @@
'cmd-_': 'window:decrease-font-size'
'cmd-0': 'window:reset-font-size'
'cmd-k up': 'pane:split-up' # Atom Specific
'cmd-k down': 'pane:split-down' # Atom Specific
'cmd-k left': 'pane:split-left' # Atom Specific
'cmd-k right': 'pane:split-right' # Atom Specific
'cmd-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
'cmd-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
'cmd-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
'cmd-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
'cmd-k cmd-w': 'pane:close' # Atom Specific
'cmd-k alt-cmd-w': 'pane:close-other-items' # Atom Specific
'cmd-k cmd-p': 'window:focus-previous-pane'

View File

@ -60,10 +60,10 @@
'ctrl-_': 'window:decrease-font-size'
'ctrl-0': 'window:reset-font-size'
'ctrl-k up': 'pane:split-up' # Atom Specific
'ctrl-k down': 'pane:split-down' # Atom Specific
'ctrl-k left': 'pane:split-left' # Atom Specific
'ctrl-k right': 'pane:split-right' # Atom Specific
'ctrl-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
'ctrl-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
'ctrl-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
'ctrl-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
'ctrl-k ctrl-w': 'pane:close' # Atom Specific
'ctrl-k alt-ctrl-w': 'pane:close-other-items' # Atom Specific
'ctrl-k ctrl-p': 'window:focus-previous-pane'

View File

@ -66,10 +66,10 @@
'ctrl-_': 'window:decrease-font-size'
'ctrl-0': 'window:reset-font-size'
'ctrl-k up': 'pane:split-up' # Atom Specific
'ctrl-k down': 'pane:split-down' # Atom Specific
'ctrl-k left': 'pane:split-left' # Atom Specific
'ctrl-k right': 'pane:split-right' # Atom Specific
'ctrl-k up': 'pane:split-up-and-copy-active-item' # Atom Specific
'ctrl-k down': 'pane:split-down-and-copy-active-item' # Atom Specific
'ctrl-k left': 'pane:split-left-and-copy-active-item' # Atom Specific
'ctrl-k right': 'pane:split-right-and-copy-active-item' # Atom Specific
'ctrl-k ctrl-w': 'pane:close' # Atom Specific
'ctrl-k alt-ctrl-w': 'pane:close-other-items' # Atom Specific
'ctrl-k ctrl-p': 'window:focus-previous-pane'

View File

@ -666,6 +666,8 @@ class Pane extends Model
when 'before' then @parent.insertChildBefore(this, newPane)
when 'after' then @parent.insertChildAfter(this, newPane)
@moveItemToPane(@activeItem, newPane) if params?.moveActiveItem
newPane.activate()
newPane

View File

@ -65,10 +65,18 @@ module.exports = ({commandRegistry, commandInstaller, config}) ->
commandRegistry.add 'atom-pane',
'pane:save-items': -> @getModel().saveItems()
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down': -> @getModel().splitDown(copyActiveItem: true)
'pane:split-left': -> @getModel().splitLeft()
'pane:split-right': -> @getModel().splitRight()
'pane:split-up': -> @getModel().splitUp()
'pane:split-down': -> @getModel().splitDown()
'pane:split-left-and-copy-active-item': -> @getModel().splitLeft(copyActiveItem: true)
'pane:split-right-and-copy-active-item': -> @getModel().splitRight(copyActiveItem: true)
'pane:split-up-and-copy-active-item': -> @getModel().splitUp(copyActiveItem: true)
'pane:split-down-and-copy-active-item': -> @getModel().splitDown(copyActiveItem: true)
'pane:split-left-and-move-active-item': -> @getModel().splitLeft(moveActiveItem: true)
'pane:split-right-and-move-active-item': -> @getModel().splitRight(moveActiveItem: true)
'pane:split-up-and-move-active-item': -> @getModel().splitUp(moveActiveItem: true)
'pane:split-down-and-move-active-item': -> @getModel().splitDown(moveActiveItem: true)
'pane:close': -> @getModel().close()
'pane:close-other-items': -> @getModel().destroyInactiveItems()
'pane:increase-size': -> @getModel().increaseSize()