 module.exports =
 EditorScrollViewComponent = React.createClass
   displayName: 'EditorScrollViewComponent'
+
+  measurementPaused: false
+  measurementPending: false
+  measurementRequested: false
 
   render: ->
     {editor, fontSize, fontFamily, lineHeight, showIndentGuide, cursorBlinkPeriod, cursorBlinkResumeDelay} = @props

React = require 'react'
{div} = require 'reactionary'

InputComponent = require './input-component'
LinesComponent = require './lines-component'

          SelectionsComponent({editor})

  componentDidMount: ->
    @getDOMNode().addEventListener 'overflowchanged', @requestMeasurement
    @measureHeightAndWidth()

  componentDidUpdate: ->
    @pauseMeasurement()

  requestMeasurement: ->
    if @measurementPaused
      @measurementRequested = true
    else unless @measurementPending
      @measurementPending = true
      requestAnimationFrame =>
        @measurementPending = false
        @measureHeightAndWidth()

  pauseMeasurement: ->
    @measurementPaused = true
    @resumeOverflowChangedEventsAfterDelay ?= debounce(@resumeMeasurement, 500)
    @resumeOverflowChangedEventsAfterDelay()

  resumeMeasurement: ->
    @measurementPaused = false
    if @measurementRequested
      @measurementRequested = false
      @requestMeasurement()

  resumeMeasurementAfterDelay: null

  onInput: (char, replaceLastCharacter) ->
    {editor} = @props
