       when 'block' then mark.type = 'block'; mark.position = 'after'
     @decoration = @editor.decorateMarker @marker, mark
     if @type == 'inline'
-      setTimeout (=> resizer.listenTo @editor.editorElement, => @updateWidth()), 50
+      resizer.listenTo @editor.editorElement, ((el) => debouncedUpdateWidth(this, el))()
 
   initMarker: ->
     @marker = @editor.markBufferRange @lineRange(@start, @end)

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

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

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

