<commit_before>_ = require 'underscore-plus'
Delegator = require 'delegato'
Grim = require 'grim'
Serializable = require 'serializable'
{Subscriber} = require 'emissary'
EmitterMixin = require('emissary').Emitter
{Emitter, CompositeDisposable} = require 'event-kit'
{File} = require 'pathwatcher'
SpanSkipList = require 'span-skip-list'
diff = require 'atom-diff'
Q = require 'q'
Point = require './point'
Range = require './range'
History = require './history'
MarkerManager = require './marker-manager'
BufferPatch = require './buffer-patch'
{spliceArray, newlineRegex} = require './helpers'

# Extended: A mutable text container with undo/redo support and the ability to
# annotate logical regions in the text.
module.exports =
class TextBuffer
  @Point: Point
  @Range: Range
  @newlineRegex: newlineRegex

  Delegator.includeInto(this)
  EmitterMixin.includeInto(this)
  Serializable.includeInto(this)
  Subscriber.includeInto(this)

  cachedText: null
  stoppedChangingDelay: 300
  stoppedChangingTimeout: null
  cachedDiskContents: null
  conflict: false
  file: null
  refcount: 0
  fileSubscriptions: null

  @delegatesMethods 'undo', 'redo', 'transact', 'beginTransaction', 'commitTransaction',
    'abortTransaction', 'isTransacting', 'clearUndoStack', toProperty: 'history'

  ###
  Section: Construction
  ###

  # Public: Create a new buffer with the given params.
  #
  # * `params` {Object} or {String} of text
  #   * `load` A {Boolean}, `true` to asynchronously load the buffer from disk
  #     after initialization.
  #   * `text` The initial {String} text of the buffer.<commit_msg>Add encoding default<commit_after>_ = require 'underscore-plus'
Delegator = require 'delegato'
Grim = require 'grim'
Serializable = require 'serializable'
{Subscriber} = require 'emissary'
EmitterMixin = require('emissary').Emitter
{Emitter, CompositeDisposable} = require 'event-kit'
{File} = require 'pathwatcher'
SpanSkipList = require 'span-skip-list'
diff = require 'atom-diff'
Q = require 'q'
Point = require './point'
Range = require './range'
History = require './history'
MarkerManager = require './marker-manager'
BufferPatch = require './buffer-patch'
{spliceArray, newlineRegex} = require './helpers'

# Extended: A mutable text container with undo/redo support and the ability to
# annotate logical regions in the text.
module.exports =
class TextBuffer
  @Point: Point
  @Range: Range
  @newlineRegex: newlineRegex

  Delegator.includeInto(this)
  EmitterMixin.includeInto(this)
  Serializable.includeInto(this)
  Subscriber.includeInto(this)

  cachedText: null
  encoding: null
  stoppedChangingDelay: 300
  stoppedChangingTimeout: null
  cachedDiskContents: null
  conflict: false
  file: null
  refcount: 0
  fileSubscriptions: null

  @delegatesMethods 'undo', 'redo', 'transact', 'beginTransaction', 'commitTransaction',
    'abortTransaction', 'isTransacting', 'clearUndoStack', toProperty: 'history'

  ###
  Section: Construction
  ###

  # Public: Create a new buffer with the given params.
  #
  # * `params` {Object} or {String} of text
  #   * `load` A {Boolean}, `true` to asynchronously load the buffer from disk
  #     after initialization.
  #   * `text` The initial {String} text of the buffer.
{'fraction_non_alphanumeric': 0.11424148606811145, 'fraction_numerical': 0.002476780185758514, 'mean_word_length': 4.779964221824687, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, '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': '4190350', 'n_tokens_mistral': 995, 'n_tokens_neox': 980, 'n_words': 299}