   copyItem: (item) ->
     item.copy?() ? atom.deserializers.deserialize(item.serialize())
 
-  closeOtherTabs: ->
+  closeOtherTabs: (active) ->
     tabs = @getTabs()
-    active = @children('.right-clicked')[0]
-    active ?= @tabForItem(@pane.getActiveItem())
+    active ?= @children('.right-clicked')[0]
     return unless active?
     @closeTab tab for tab in tabs when tab isnt active
 
-  closeTabsToRight: ->
+  closeTabsToRight: (active) ->
     tabs = @getTabs()
-    active = @children('.right-clicked')[0]
-    active ?= @tabForItem(@pane.getActiveItem())
+    active ?= @children('.right-clicked')[0]
     index = tabs.indexOf(active)
     return if index is -1
     @closeTab tab for tab, i in tabs when i > index

      @element.querySelector('.tab.active')?.classList.remove('active')
      tabView.classList.add('active')

  updateActiveTab: ->
    @setActiveTab(@tabForItem(@pane.getActiveItem()))

  closeTab: (tab) ->
    tab ?= @children('.right-clicked')[0]
    tab ?= @tabForItem(@pane.getActiveItem())
    @pane.destroyItem(tab.item) if tab?

  splitTab: (fn) ->

      'tabs:keep-preview-tab': => @clearPreviewTabs()

    @subscriptions.add atom.commands.add 'atom-workspace',
      'tabs:close-tab': => @closeTab(@getActiveTab())
      'tabs:close-other-tabs': => @closeOtherTabs(@getActiveTab())
      'tabs:close-tabs-to-right': => @closeTabsToRight(@getActiveTab())
      'tabs:close-saved-tabs': => @closeSavedTabs()
      'tabs:close-all-tabs': => @closeAllTabs()

