     shellView.registerListener KDEventTypes:'ViewClosed', listener:@, callback:@closeView
     resetRegexp = /reset\:.*?/
     @dmp = new diff_match_patch()
-    @screenHistory = [""]
+    @lastScreen = ""
+    @bufferedKeyStrokes = []
     
     shellView.registerListener KDEventTypes:'AdvancedSettingsFunction', listener:@, callback:(pubInst, {functionName})=>
       switch functionName

      @terminal.resize options.rows, options.cols
    catch e
      console.log "terminal.resize error #{e}"

  send: (command) ->
    # console.log "sending:"+command
    try
      @terminal.write command
    catch e
      console.log "terminal.write error : #{e}"


# define ()->

      i = _lastMessageProcessed
      for diff in (item while (item = _orderedMessages[i++])?)
        # console.log "updating screen with:",diff
        currentScreen = (@dmp.patch_apply diff,@lastScreen)[0]
        @getView().updateScreen(currentScreen)
        @lastScreen = currentScreen      
        @_lastMessageProcessed = i-1
  
  resetMessageCounter:->
    console.log 'message counter is reset.'
