       event.preventDefault()
 
   keyPress: (event) ->
+
     if event.metaKey
       switch event.charCode
         when 97, 114, 118, 119

          # meta-V is paste
          # meta-W is window.close
          return
    unless (event.ctrlKey and not event.altKey) or event.charCode is 0
      @terminal.server.input String.fromCharCode(event.charCode)
    event.preventDefault()

  keyUp: (event) ->
    # nothing to do

  setMouseMode: (@trackMouseDown, @trackMouseUp, @trackMouseHold) ->
    @terminal.outputbox.css "cursor", if @trackMouseDown then "pointer" else "text"

  mouseEvent: (event) ->
    offset = @terminal.container.offset()
    x = Math.floor((event.originalEvent.clientX - offset.left + @terminal.container.scrollLeft()) * @terminal.sizeX / @terminal.container.prop("scrollWidth"))
    y = Math.floor((event.originalEvent.clientY - offset.top + @terminal.container.scrollTop()) * @terminal.screenBuffer.lineDivs.length / @terminal.container.prop("scrollHeight") - @terminal.screenBuffer.lineDivs.length + @terminal.sizeY)
    return if x < 0 or x >= @terminal.sizeX or y < 0 or y >= @terminal.sizeY
    eventCode = 0
    eventCode |= 4 if event.shiftKey
    eventCode |= 8 if event.altKey
    eventCode |= 16 if event.ctrlKey
    switch event.type
      when "mousedown"
        return if not @trackMouseDown

    @previousMouseX = -1
    @previousMouseY = -1


  keyDown: (event) ->

    @terminal.scrollToBottom()
    @terminal.cursor.resetBlink()

