<commit_before>{$, View} = require 'atom'
_ = require 'underscore-plus'
path = require 'path'

module.exports =
class TabView extends View
  @content: ->
    @li class: 'tab sortable', =>
      @div class: 'title', outlet: 'title'
      @div class: 'close-icon'

  initialize: (@item, @pane) ->
    @item.on? 'title-changed', =>
      @updateDataAttributes()
      @updateTitle()
      @updateTooltip()

    @item.on? 'icon-changed', =>
      @updateIcon()

    @item.on? 'modified-status-changed', =>
      @updateModifiedStatus()

    @subscribe atom.config.observe 'tabs.showIcons', => @updateIconVisibility()

    @updateDataAttributes()
    @updateTitle()
    @updateIcon()
    @updateModifiedStatus()
    @updateTooltip()

  updateTooltip: ->
    @destroyTooltip()

    if itemPath = @item.getPath?()
      @setTooltip
        title: _.escape(itemPath)
        delay:
          show: 2000
          hide: 100
        placement: 'bottom'

  beforeRemove: ->
    @destroyTooltip()

  updateDataAttributes: ->
    if itemPath = @item.getPath?()
      @title.element.dataset.name = path.basename(itemPath)<commit_msg>Defer tooltips until a mouseenter occurs<commit_after>{$, View} = require 'atom'
_ = require 'underscore-plus'
path = require 'path'

module.exports =
class TabView extends View
  @content: ->
    @li class: 'tab sortable', =>
      @div class: 'title', outlet: 'title'
      @div class: 'close-icon'

  initialize: (@item, @pane) ->
    @item.on? 'title-changed', =>
      @updateDataAttributes()
      @updateTitle()
      @updateTooltip()

    @item.on? 'icon-changed', =>
      @updateIcon()

    @item.on? 'modified-status-changed', =>
      @updateModifiedStatus()

    @subscribe atom.config.observe 'tabs.showIcons', => @updateIconVisibility()

    @updateDataAttributes()
    @updateTitle()
    @updateIcon()
    @updateModifiedStatus()

    # Defer creating the tooltip until the tab is moused over
    @one 'mouseenter', =>
      @hasBeenMousedOver = true
      @updateTooltip()
      @trigger 'mouseenter' # Trigger again so the tooltip shows

  updateTooltip: ->
    return unless @hasBeenMousedOver

    @destroyTooltip()

    if itemPath = @item.getPath?()
      @setTooltip
        title: _.escape(itemPath)
        delay:
          show: 2000
          hide: 100
        placement: 'bottom'

  beforeRemove: ->
    @destroyTooltip()

  updateDataAttributes: ->
    if itemPath = @item.getPath?()
      @title.element.dataset.name = path.basename(itemPath)
{'fraction_non_alphanumeric': 0.13970293054997993, 'fraction_numerical': 0.005620232838217583, 'mean_word_length': 2.8876755070202806, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 24, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5679773', 'n_tokens_mistral': 793, 'n_tokens_neox': 762, 'n_words': 175}