     @root.scrollTo '100%'
     return
   
+  cullBuffer: ->
+    children = @buffer.children()
+    overflow = children.length - @bufferLimit
+    if overflow > 0
+      children.slice(0, overflow).remove()
+  
   # I'd love to use CSS transitions but they don't work when the display
   # style changes.
   show: ->

    @history = [ ]
    @history.limit = 100
    @history.index = -1
    
    @input.keydown (event) => @handleKey(event)
  

  
  dump: (object) ->
    try
      html = Console.valueToHtml object, collapse: true
      $('<div>')
      .addClass('console-dump')
      .append(html)
      .appendTo(@buffer)
    finally
      @cullBuffer()
      @scrollToBottom()

$ ->
