     reset: () =>
         # reset the terminal to clean; need to do this on connect or reconnect.
         #$(@terminal.element).css('opacity':'0.5').animate(opacity:1, duration:500)
-        @value = ''
+        @value = @value_orig = ''
         @scrollbar_nlines = 0
         @scrollbar.empty()
         @terminal.reset()


    refresh: () =>
        @terminal.refresh(0, @opts.rows-1)


    # Determine the current size (rows and columns) of the DOM

        @_needs_resize = false
        @session.write_data(resize_code(@opts.cols, @opts.rows))

        @full_rerender()

        # Refresh depends on correct @opts being set!
        @refresh()

    full_rerender: =>
        value = @value_orig
        @reset()
        @render(value)

    resize_terminal: () =>
        # Determine size of container DOM.
