mirror of
https://github.com/atom/atom.git
synced 2026-01-21 04:48:12 -05:00
@@ -29,6 +29,8 @@
|
||||
'ctrl-alt-cmd-l': 'window:reload'
|
||||
'alt-cmd-i': 'window:toggle-dev-tools'
|
||||
'cmd-alt-ctrl-p': 'window:run-package-specs'
|
||||
'ctrl-shift-left': 'pane:move-item-left'
|
||||
'ctrl-shift-right': 'pane:move-item-right'
|
||||
|
||||
# Sublime Parity
|
||||
'cmd-,': 'application:show-settings'
|
||||
|
||||
@@ -12,6 +12,8 @@
|
||||
'ctrl-alt-s': 'application:run-all-specs'
|
||||
'ctrl-alt-o': 'application:open-dev'
|
||||
'ctrl-shift-o': 'application:open-folder'
|
||||
'ctrl-shift-pageup': 'pane:move-item-left'
|
||||
'ctrl-shift-pagedown': 'pane:move-item-right'
|
||||
'F11': 'window:toggle-full-screen'
|
||||
|
||||
# Sublime Parity
|
||||
|
||||
@@ -16,6 +16,8 @@
|
||||
'ctrl-alt-s': 'application:run-all-specs'
|
||||
'ctrl-alt-o': 'application:open-dev'
|
||||
'ctrl-shift-o': 'application:open-folder'
|
||||
'ctrl-shift-left': 'pane:move-item-left'
|
||||
'ctrl-shift-right': 'pane:move-item-right'
|
||||
'F11': 'window:toggle-full-screen'
|
||||
|
||||
# Sublime Parity
|
||||
|
||||
@@ -146,6 +146,24 @@ describe "Pane", ->
|
||||
pane.activateNextItem()
|
||||
expect(pane.getActiveItem()).toBe item1
|
||||
|
||||
describe "::moveItemRight() and ::moveItemLeft()", ->
|
||||
it "moves the active item to the right and left, without looping around at either end", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
|
||||
[item1, item2, item3] = pane.getItems()
|
||||
|
||||
pane.activateItemAtIndex(0)
|
||||
expect(pane.getActiveItem()).toBe item1
|
||||
pane.moveItemLeft()
|
||||
expect(pane.getItems()).toEqual [item1, item2, item3]
|
||||
pane.moveItemRight()
|
||||
expect(pane.getItems()).toEqual [item2, item1, item3]
|
||||
pane.moveItemLeft()
|
||||
expect(pane.getItems()).toEqual [item1, item2, item3]
|
||||
pane.activateItemAtIndex(2)
|
||||
expect(pane.getActiveItem()).toBe item3
|
||||
pane.moveItemRight()
|
||||
expect(pane.getItems()).toEqual [item1, item2, item3]
|
||||
|
||||
describe "::activateItemAtIndex(index)", ->
|
||||
it "activates the item at the given index", ->
|
||||
pane = new Pane(items: [new Item("A"), new Item("B"), new Item("C")])
|
||||
|
||||
@@ -119,6 +119,8 @@ atom.commands.add 'atom-pane',
|
||||
'pane:show-item-7': -> @getModel().activateItemAtIndex(6)
|
||||
'pane:show-item-8': -> @getModel().activateItemAtIndex(7)
|
||||
'pane:show-item-9': -> @getModel().activateItemAtIndex(8)
|
||||
'pane:move-item-right': -> @getModel().moveItemRight()
|
||||
'pane:move-item-left': -> @getModel().moveItemLeft()
|
||||
'pane:split-left': -> @getModel().splitLeft(copyActiveItem: true)
|
||||
'pane:split-right': -> @getModel().splitRight(copyActiveItem: true)
|
||||
'pane:split-up': -> @getModel().splitUp(copyActiveItem: true)
|
||||
|
||||
@@ -289,6 +289,18 @@ class Pane extends Model
|
||||
else
|
||||
@activateItemAtIndex(@items.length - 1)
|
||||
|
||||
# Public: Move the active tab to the right.
|
||||
moveItemRight: ->
|
||||
index = @getActiveItemIndex()
|
||||
rightItemIndex = index + 1
|
||||
@moveItem(@getActiveItem(), rightItemIndex) unless rightItemIndex > @items.length - 1
|
||||
|
||||
# Public: Move the active tab to the left
|
||||
moveItemLeft: ->
|
||||
index = @getActiveItemIndex()
|
||||
leftItemIndex = index - 1
|
||||
@moveItem(@getActiveItem(), leftItemIndex) unless leftItemIndex < 0
|
||||
|
||||
# Public: Get the index of the active item.
|
||||
#
|
||||
# Returns a {Number}.
|
||||
|
||||
Reference in New Issue
Block a user