 # TODO: better scrolling behaviour
-{throttle} = require 'underscore-plus'
+{throttle, debounce} = require 'underscore-plus'
 {$, $$} = require 'atom-space-pen-views'
 {CompositeDisposable, Emitter} = require 'atom'
 trees = require '../tree'

    @decorateMarker()
    @disposables.add @marker.onDidChange (e) => @checkMarker e

  updateWidth: ->
    elRect = @editor.editorElement.getBoundingClientRect()
    if not @view.parentElement? then return
    w = elRect.width + elRect.left - 40 -
        @view.parentElement.getBoundingClientRect().left
    if w < 100 then w = 100
    @view.style.maxWidth = w + 'px'


metrics = throttle metrics, 60*60*1000

resizer = ResizeDetector strategy: "scroll"

debouncedUpdateWidth = (res, el) -> debounce(((res, el) -> res.updateWidth(el)), 200)

module.exports =
class Result
