<commit_before>blame = require './utils/blame'
{CompositeDisposable} = require 'atom'

class BlameGutterView

  constructor: (@state, @editor) ->

    #unless @state.width
    @state.width = atom.config.get('blame.defaultWidth')
    @setGutterWidth @state.width

    @colors = {}
    @gutter = @editor.addGutter( name: 'blame' )
    @markers = []

    @setVisible(yes)

  toggleVisible: ->
    @setVisible(not @visible)

  setVisible: (@visible) ->
    if @editor.isModified() then @visible = no

    if @visible
      @update()
      @subscriptions ?= new CompositeDisposable
      @subscriptions.add @editor.onDidSave => @update()
      @gutter.show()

    else
      @gutter.hide()
      @removeAllMarkers()
      @subscriptions?.dispose()
      @subscriptions = null

  update: () ->

    blame @editor.getPath(), (result) =>

      @removeAllMarkers()

      blameLines = []
      lastHash = null

      commitCount = 0
      commitColor = null

      for key, line of result
        idx = Number(key) - 1
        hash = line.rev.replace(/\s.*/, '')

        unless lastHash is hash
          dateStr = @formateData(line.date)
          lineStr = "#{hash} #{dateStr} #{line.author}"
          if commitCount++ % 2 is 0
            rowCls = 'blame-even'
          else
            rowCls = 'blame-odd'
        else
          neStr= 'removebr>'

        lastHash = hash

        @addMarker idx, hash, rowCls, lineStr

  itemClicked: (hash) ->

  formateData: (date) -><commit_msg>Fix grouping<commit_after>blame = require './utils/blame'
{CompositeDisposable} = require 'atom'

class BlameGutterView

  constructor: (@state, @editor) ->

    #unless @state.width
    @state.width = atom.config.get('blame.defaultWidth')
    @setGutterWidth @state.width

    @colors = {}
    @gutter = @editor.addGutter( name: 'blame' )
    @markers = []

    @setVisible(yes)

  toggleVisible: ->
    @setVisible(not @visible)

  setVisible: (@visible) ->
    if @editor.isModified() then @visible = no

    if @visible
      @update()
      @subscriptions ?= new CompositeDisposable
      @subscriptions.add @editor.onDidSave => @update()
      @gutter.show()

    else
      @gutter.hide()
      @removeAllMarkers()
      @subscriptions?.dispose()
      @subscriptions = null

  update: () ->

    blame @editor.getPath(), (result) =>

      @removeAllMarkers()

      blameLines = []
      lastHash = null

      commitCount = 0
      commitColor = null

      for key, line of result
        idx = Number(key) - 1
        hash = line.rev.replace(/\s.*/, '')

        unless lastHash is hash
          dateStr = @formateData(line.date)
          lineStr = "#{hash} #{dateStr} #{line.author}"
          if commitCount++ % 2 is 0
            rowCls = 'blame-even'
          else
            rowCls = 'blame-odd'
        else
          lineStr= '<br>'

        lastHash = hash

        @addMarker idx, hash, rowCls, lineStr

  itemClicked: (hash) ->

  formateData: (date) ->
{'fraction_non_alphanumeric': 0.13538149898717083, 'fraction_numerical': 0.0027008777852802163, 'mean_word_length': 2.2067099567099566, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 21, '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': '1754907', 'n_tokens_mistral': 980, 'n_tokens_neox': 928, 'n_words': 213}