<commit_before>{View} = require 'atom'

module.exports =
class SelectionCountView extends View
  @content: ->
    @div class: "selection-count inline-block"

  initialize: (@statusBar) ->
    @subscribe atom.workspaceView.eachEditorView (editor) =>
      @subscribe editor, "selection:changed", @updateCount
    @subscribe atom.workspaceView, "pane-container:active-pane-item-changed", @updateCount

  destroy: ->
    @remove()

  afterAttach: ->
    @updateCount()

  updateCount: =>
    count = atom.workspace.getActiveEditor()?.getSelection().getText().length
    if count > 0
      @text("(#{count})").show()
    else
      @hide()<commit_msg>Use event provided by status bar<commit_after>{View} = require 'atom'

module.exports =
class SelectionCountView extends View
  @content: ->
    @div class: "selection-count inline-block"

  initialize: (@statusBar) ->
    @subscribe atom.workspaceView.eachEditorView (editor) =>
      @subscribe editor, "selection:changed", @updateCount
    @subscribe @statusBar, "active-buffer-changed", @updateCount

  destroy: ->
    @remove()

  afterAttach: ->
    @updateCount()

  updateCount: =>
    count = atom.workspace.getActiveEditor()?.getSelection().getText().length
    if count > 0
      @text("(#{count})").show()
    else
      @hide()
{'fraction_non_alphanumeric': 0.14840714840714841, 'fraction_numerical': 0.001554001554001554, 'mean_word_length': 3.7881040892193307, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 17, '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': '644667', 'n_tokens_mistral': 388, 'n_tokens_neox': 377, 'n_words': 82}