     newCols = Math.max 1, Math.floor swidth  / charWidth
     newRows = Math.max 1, Math.floor sheight / charHeight
 
+
     @setSize newCols, newRows
 
-  windowDidResize: _.throttle (-> @updateSize()), 500
+
+  updateAppSize: ->
+
+    { appView } = @getOptions()
+
+    height = appView.parent.getHeight() - 24 # padding
+
+    newHeight = Math.floor(height / @_mbHeight) * @_mbHeight
+
+    appView.setHeight newHeight
+
+
+  windowDidResize: _.debounce (-> @updateSize()), 100
 
   lineFeed: ->
     if @cursor.y is @screenBuffer.scrollingRegion[1]


    @updateSize()

    @container.on "mousedown mousemove mouseup mousewheel contextmenu", (event) =>
      @inputHandler.mouseEvent event

    @clientInterface =


  changeScreenBuffer: (index) ->

  isScrolledToBottom: -> @parent.isAtBottom()

  scrollToBottom: (animate = no) ->

    return  if @isScrolledToBottom()

    @container.stop()

    if animate
    then @container.animate { scrollTop : @parent.getScrollHeight() - @parent.getHeight() }, duration : 200
    else @parent.scrollToBottom()


  setScrollbackLimit: (limit) ->
    @screenBuffer.scrollbackLimit = limit
    @screenBuffer.flush()


  inspectString: (string) ->
    escaped = string.replace /[\x00-\x1f\\]/g, (character) ->
