<commit_before>{Disposable, CompositeDisposable} = require 'event-kit'

# mode names can be combined with submode names with the `$` character
# the order matters - the last matching entry wins
ContentsByMode =
  insert:           ["status-bar-vim-mode-insert", "Insert"]
  insert$replace:   ["status-bar-vim-mode-insert", "Replace"]
  command:          ["status-bar-vim-mode-command", "Command"]
  visual:           ["status-bar-vim-mode-visual", "Visual"]
  visual$linewise:  ["status-bar-vim-mode-visual", "Visual Line"]
  visual$blockwise: ["status-bar-vim-mode-visual", "Visual Block"]

module.exports =
class StatusBarManager
  constructor: ->
    @element = document.createElement("div")
    @element.id = "status-bar-vim-mode"
    @element.classList.add("inline-block")

  initialize: (@statusBar) ->

  update: (currentMode, currentSubmode) ->
    currentFullMode = currentMode + "$" + currentSubmode if currentSubmode?
    for mode, [klass, html] of ContentsByMode
      if mode is currentMode or mode is currentFullMode
        @element.classList.add(klass)
        @element.innerHTML = html
      else
        @element.classList.remove(klass)

  # Private

  attach: ->
    @tile = @statusBar.addRightTile(item: @element, priority: 20)

  detach: -><commit_msg>tweak: using `.` for separator (thanks @maxbrunsfeld)<commit_after>{Disposable, CompositeDisposable} = require 'event-kit'

# mode names can be combined with submode names with the `.` character
# the order matters - the last matching entry wins
ContentsByMode =
  'insert':           ["status-bar-vim-mode-insert",  "Insert"]
  'insert.replace':   ["status-bar-vim-mode-insert",  "Replace"]
  'command':          ["status-bar-vim-mode-command", "Command"]
  'visual':           ["status-bar-vim-mode-visual",  "Visual"]
  'visual.linewise':  ["status-bar-vim-mode-visual",  "Visual Line"]
  'visual.blockwise': ["status-bar-vim-mode-visual",  "Visual Block"]

module.exports =
class StatusBarManager
  constructor: ->
    @element = document.createElement("div")
    @element.id = "status-bar-vim-mode"
    @element.classList.add("inline-block")

  initialize: (@statusBar) ->

  update: (currentMode, currentSubmode) ->
    currentFullMode = currentMode + "." + currentSubmode if currentSubmode?
    for mode, [klass, html] of ContentsByMode
      if mode is currentMode or mode is currentFullMode
        @element.classList.add(klass)
        @element.innerHTML = html
      else
        @element.classList.remove(klass)

  # Private

  attach: ->
    @tile = @statusBar.addRightTile(item: @element, priority: 20)

  detach: ->
{'fraction_non_alphanumeric': 0.14022281982328083, 'fraction_numerical': 0.001536688436419516, 'mean_word_length': 3.5208333333333335, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 13, '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': '2108808', 'n_tokens_mistral': 824, 'n_tokens_neox': 787, 'n_words': 185}