         @pendingScrollTop = null
 
   onMousewheel: (event) ->
+    # To preserve velocity scrolling, delay removal of the event's target until
+    # after mousewheel events stop being fired. Removing the target before then
+    # will cause scrolling to stop suddenly.
+    @visibleRowOverrides = @getVisibleRowRange()
+    @clearVisibleRowOverridesAfterDelay ?= debounce(@clearVisibleRowOverrides, 40)
+    @clearVisibleRowOverridesAfterDelay()
+
     @refs.verticalScrollbar.getDOMNode().scrollTop -= event.wheelDeltaY
     event.preventDefault()
+
+  clearVisibleRowOverrides: ->
+    @visibleRowOverrides = null
+    @forceUpdate()
+
+  clearVisibleRowOverridesAfterDelay: null
 
   onOverflowChanged: ->
     @props.editor.setHeight(@refs.scrollView.getDOMNode().clientHeight)

    {lineHeightInPixels, charWidth}

  measureNewLines: ->
    [visibleStartRow, visibleEndRow] = @props.editor.getVisibleRowRange()
    linesNode = @refs.lines.getDOMNode()

    for tokenizedLine, i in @props.editor.linesForScreenRows(visibleStartRow, visibleEndRow - 1)

{React, div, span} = require 'reactionary'
{$$} = require 'space-pen'
{debounce} = require 'underscore-plus'

InputComponent = require './input-component'
SelectionComponent = require './selection-component'
