Remap pane:show-item-9 to activate last pane item

This commit is contained in:
Eli Fatsi
2015-11-11 10:08:12 -07:00
parent 24e64ee9e1
commit 84a6f0cb75
3 changed files with 13 additions and 1 deletions

View File

@@ -168,6 +168,15 @@ describe "Pane", ->
pane.activateNextItem()
expect(pane.getActiveItem()).toBe item1
describe "::activateLastItem()", ->
it "sets the active item to the last item", ->
pane = new Pane(paneParams(items: [new Item("A"), new Item("B"), new Item("C")]))
[item1, item2, item3] = pane.getItems()
expect(pane.getActiveItem()).toBe item1
pane.activateLastItem()
expect(pane.getActiveItem()).toBe item3
describe "::moveItemRight() and ::moveItemLeft()", ->
it "moves the active item to the right and left, without looping around at either end", ->
pane = new Pane(paneParams(items: [new Item("A"), new Item("B"), new Item("C")]))

View File

@@ -312,6 +312,9 @@ class Pane extends Model
else
@activateItemAtIndex(@items.length - 1)
activateLastItem: ->
@activateItemAtIndex(@items.length - 1)
# Public: Move the active tab to the right.
moveItemRight: ->
index = @getActiveItemIndex()

View File

@@ -12,7 +12,7 @@ module.exports = ({commandRegistry, commandInstaller, config}) ->
'pane:show-item-6': -> @getModel().getActivePane().activateItemAtIndex(5)
'pane:show-item-7': -> @getModel().getActivePane().activateItemAtIndex(6)
'pane:show-item-8': -> @getModel().getActivePane().activateItemAtIndex(7)
'pane:show-item-9': -> @getModel().getActivePane().activateItemAtIndex(8)
'pane:show-item-9': -> @getModel().getActivePane().activateLastItem()
'pane:move-item-right': -> @getModel().getActivePane().moveItemRight()
'pane:move-item-left': -> @getModel().getActivePane().moveItemLeft()
'window:increase-font-size': -> @getModel().increaseFontSize()