     @subscriptions = new CompositeDisposable
 
     @subscriptions.add atom.commands.add atom.views.getView(@pane),
-      'tabs:keep-preview-tab': => tab.clearPreview() for tab in @getTabs()
+      'tabs:keep-preview-tab': => @clearPreviewTabs()
 
     @subscriptions.add atom.commands.add @element,
       'tabs:close-tab': => @closeTab()


    @subscriptions.add @pane.onDidChangeActiveItem (item) =>
      if @isPreviewableItem(item) and @getTabs().length > 1
        previewTab = @getPreviewTab()
        @pane.destroyItem(previewTab.item) if previewTab
      @updateActiveTab()

    @subscriptions.add atom.config.observe 'tabs.tabScrolling', => @updateTabScrolling()

  isPreviewableItem: (item) ->
    atom.config.get('tabs.usePreviewTabs') and item instanceof TextEditor

  clearPreviewTabs: ->
    tab.clearPreview() for tab in @getTabs()
    return

  addTabForItem: (item, index) ->
    tabView = new TabView()
    tabView.initialize(item)
    @previewTab ?= tabView if tabView.isPreviewTab
    @insertTabAtIndex(tabView, index)

  moveItemTabToIndex: (item, index) ->
    if tab = @tabForItem(item)
