<commit_before>scrollbarStyle = require 'scrollbar-style'
{Range, Point} = require 'text-buffer'
{CompositeDisposable} = require 'event-kit'
{ipcRenderer} = require 'electron'
Grim = require 'grim'

TextEditorPresenter = require './text-editor-presenter'
GutterContainerComponent = require './gutter-container-component'
InputComponent = require './input-component'
LinesComponent = require './lines-component'
ScrollbarComponent = require './scrollbar-component'
ScrollbarCornerComponent = require './scrollbar-corner-component'
OverlayManager = require './overlay-manager'
DOMElementPool = require './dom-element-pool'
LinesYardstick = require './lines-yardstick'
BlockDecorationsComponent = require './block-decorations-component'
LineTopIndex = require 'line-top-index'

module.exports =
class TextEditorComponent
  cursorBlinkPeriod: 800
  cursorBlinkResumeDelay: 100
  tileSize: 12

  pendingScrollTop: null
  pendingScrollLeft: null
  updateRequested: false
  updatesPaused: false
  updateRequestedWhilePaused: false
  heightAndWidthMeasurementRequested: false
  inputEnabled: true
  measureScrollbarsWhenShown: true
  measureLineHeightAndDefaultCharWidthWhenShown: true
  stylingChangeAnimationFrameRequested: false
  gutterComponent: null
  mounted: true
  initialized: false

  Object.defineProperty @prototype, "domNode",
    get: -> @domNodeValue
    set: (domNode) ->
      @assert domNode?, "TextEditorComponent::domNode was set to null."
      @domNodeValue = domNode

  constructor: ({@editor, @hostElement, tileSize, @views, @themes, @styles, @assert}) ->
    @tileSize = tileSize if tileSize?
    @disposables = new CompositeDisposable

    lineTopIndex = new LineTopIndex({
      defaultLineHeight: @editor.getLineHeightInPixels()
    })
    @presenter = new TextEditorPresenter
      model: @editor
      tileSize: tileSize
      cursorBlinkPeriod: @cursorBlinkPeriod
      cursorBlinkResumeDelay: @cursorBlinkResumeDelay
      stoppedScrollingDelay: 200
      lineTopIndex: lineTopIndex
      autoHeight: @editor.getAutoHeight()

    @presenter.onDidUpdateState(@requestUpdate)

    @domElementPool = new DOMElementPool
    @domNode = document.createElement('div')
    @domNode.classList.add('editor-contents')
    @overlayManager = new OverlayManager(@presenter, @domNode, @views)
    @blockDecorationsComponent = new BlockDecorationsComponent(@hostElement, @views, @presenter, @domElementPool)

    @scrollViewNode = document.createElement('div')
    @scrollViewNode.classList.add('scroll-view')
    @domNode.appendChild(@scrollViewNode)

    @hiddenInputComponent = new InputComponent
    @scrollViewNode.appendChild(@hiddenInputComponent.getDomNode())

    @linesComponent = new LinesComponent({@presenter, @hostElement, @domElementPool, @assert, @grammars})<commit_msg>Add backward compatible classes to TextEditorComponent's root node<commit_after>scrollbarStyle = require 'scrollbar-style'
{Range, Point} = require 'text-buffer'
{CompositeDisposable} = require 'event-kit'
{ipcRenderer} = require 'electron'
Grim = require 'grim'

TextEditorPresenter = require './text-editor-presenter'
GutterContainerComponent = require './gutter-container-component'
InputComponent = require './input-component'
LinesComponent = require './lines-component'
ScrollbarComponent = require './scrollbar-component'
ScrollbarCornerComponent = require './scrollbar-corner-component'
OverlayManager = require './overlay-manager'
DOMElementPool = require './dom-element-pool'
LinesYardstick = require './lines-yardstick'
BlockDecorationsComponent = require './block-decorations-component'
LineTopIndex = require 'line-top-index'

module.exports =
class TextEditorComponent
  cursorBlinkPeriod: 800
  cursorBlinkResumeDelay: 100
  tileSize: 12

  pendingScrollTop: null
  pendingScrollLeft: null
  updateRequested: false
  updatesPaused: false
  updateRequestedWhilePaused: false
  heightAndWidthMeasurementRequested: false
  inputEnabled: true
  measureScrollbarsWhenShown: true
  measureLineHeightAndDefaultCharWidthWhenShown: true
  stylingChangeAnimationFrameRequested: false
  gutterComponent: null
  mounted: true
  initialized: false

  Object.defineProperty @prototype, "domNode",
    get: -> @domNodeValue
    set: (domNode) ->
      @assert domNode?, "TextEditorComponent::domNode was set to null."
      @domNodeValue = domNode

  constructor: ({@editor, @hostElement, tileSize, @views, @themes, @styles, @assert}) ->
    @tileSize = tileSize if tileSize?
    @disposables = new CompositeDisposable

    lineTopIndex = new LineTopIndex({
      defaultLineHeight: @editor.getLineHeightInPixels()
    })
    @presenter = new TextEditorPresenter
      model: @editor
      tileSize: tileSize
      cursorBlinkPeriod: @cursorBlinkPeriod
      cursorBlinkResumeDelay: @cursorBlinkResumeDelay
      stoppedScrollingDelay: 200
      lineTopIndex: lineTopIndex
      autoHeight: @editor.getAutoHeight()

    @presenter.onDidUpdateState(@requestUpdate)

    @domElementPool = new DOMElementPool
    @domNode = document.createElement('div')
    @domNode.classList.add('editor-contents')
    # TODO: Remove these backwards compatible classes once everyone has
    # transitioned to non-shadow DOM selectors.
    @domNode.classList.add('editor-contents--private')
    @domNode.classList.add('editor--private')

    @overlayManager = new OverlayManager(@presenter, @domNode, @views)
    @blockDecorationsComponent = new BlockDecorationsComponent(@hostElement, @views, @presenter, @domElementPool)

    @scrollViewNode = document.createElement('div')
    @scrollViewNode.classList.add('scroll-view')
    @domNode.appendChild(@scrollViewNode)

    @hiddenInputComponent = new InputComponent
    @scrollViewNode.appendChild(@hiddenInputComponent.getDomNode())

    @linesComponent = new LinesComponent({@presenter, @hostElement, @domElementPool, @assert, @grammars})
{'fraction_non_alphanumeric': 0.0990622335890878, 'fraction_numerical': 0.0037510656436487637, 'mean_word_length': 5.213983050847458, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 9, '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': '6624595', 'n_tokens_mistral': 1679, 'n_tokens_neox': 1632, 'n_words': 362}