 {React, div, span} = require 'reactionary'
 {$$} = require 'space-pen'
+{debounce} = require 'underscore-plus'
 
 InputComponent = require './input-component'
 SelectionComponent = require './selection-component'

        @pendingScrollTop = null

  onMousewheel: (event) ->
    @refs.verticalScrollbar.getDOMNode().scrollTop -= event.wheelDeltaY
    event.preventDefault()

  onOverflowChanged: ->
    @props.editor.setHeight(@refs.scrollView.getDOMNode().clientHeight)

      div className: 'spacer', key: 'bottom-spacer', style: {height: followingHeight}
    ]

  renderCursors: ->
    {editor} = @props

    for selection in editor.getSelections() when editor.selectionIntersectsVisibleRowRange(selection)
      CursorComponent(cursor: selection.cursor)

  renderUnderlayer: ->
    {editor} = @props

    div className: 'underlayer',
      for selection in editor.getSelections() when editor.selectionIntersectsVisibleRowRange(selection)
        SelectionComponent({selection})

  getVisibleRowRange: ->
    visibleRowRange = @props.editor.getVisibleRowRange()
    if @visibleRowOverrides?
      visibleRowRange[0] = Math.min(visibleRowRange[0], @visibleRowOverrides[0])
      visibleRowRange[1] = Math.max(visibleRowRange[1], @visibleRowOverrides[1])
    visibleRowRange

  getInitialState: -> {}

