<commit_before>class Carmenta.HistoryBuffer

  constructor: (@maxLength = 200) ->
    @index = 0
    @stack = []


  push: (item) ->
    return if @stack[@index] && @stack[@index].replace(/<em class="carmenta-marker"><\/em>/g, '') == item.replace(/<em class="carmenta-marker"><\/em>/g, '') # if it's the same, don't do anything

    @stack = @stack[0...@index + 1]
    @stack.push(item)
    @stack.shift() if @stack.length > @maxLength
    @index = @stack.length - 1


  undo: ->
    return null if @index < 1
    @index -= 1
    return @stack[@index]


  redo: ->
    return null if @index > @stack.length - 2
    @index += 1
    return @stack[@index]<commit_msg>minor change to history buffer (simple semantic adjustment)<commit_after>class Carmenta.HistoryBuffer

  constructor: (@maxLength = 200) ->
    @index = 0
    @stack = []


  push: (item) ->
    return if @stack[@index] && @stack[@index].replace(/<em class="carmenta-marker"><\/em>/g, '') == item.replace(/<em class="carmenta-marker"><\/em>/g, '') # if it's the same, don't do anything

    @stack = @stack[0...@index + 1]
    @stack.push(item)
    @stack.shift() if @stack.length > @maxLength
    @index = @stack.length - 1

    #Carmenta.log(@stack.length, '------------------------------------------------------------')
    #Carmenta.log(@stack)


  undo: ->
    return null if @index < 1
    @index -= 1
    return @stack[@index]


  redo: ->
    return null if @index >= @stack.length - 1
    @index += 1
    return @stack[@index]
{'fraction_non_alphanumeric': 0.22214809873248834, 'fraction_numerical': 0.01467645096731154, 'mean_word_length': 2.480278422273782, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 23, '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': '3629146', 'n_tokens_mistral': 529, 'n_tokens_neox': 481, 'n_words': 120}