 
 
   rebuildMinimap: ->
+    return if @rebuilding
+
     @startBench()
 
+    @rebuilding = true
     lines = @lines[0]
     if lines?
       child = lines.childNodes[0]

    @lines.css fontSize: "#{@editorView.getFontSize()}px"

    @markIntermediateTime('cleaning')
    # FIXME: If the file is very large, the tokenizes doesn't generate
    # completely, so doesn't have the syntax highlight until a new view
    # is activated in the same pane.
    numLines = @editorView.getModel().displayBuffer.getLines().length
    lines = @editorView.buildLineElementsForScreenRows(0, numLines)

    @markIntermediateTime('lines building')
    wrapper = $('<div/>')
    wrapper.append lines
    @lines.append wrapper

    @endBench('minimap update')

  getClientRect: ->
    sv = @scrollView[0]

        @deleteRowsAtRange(oldScreenRange)
        @createRowsAtRange(newScreenRange)
        @markIntermediateTime("update buffer change")

      catch e
        continue

    @endBench('complete update')
    @emit 'minimap:updated'

  deleteRowsAtRange: (range) ->
    linesWrapper = @lines[0].childNodes[0]
