         @sendChat()
       when 9   # [Tab]
         e.preventDefault()
-        @tabComplete($input)
+        @tabComplete($input, reverse: e.shiftKey)
       when 38  # [Up arrow]
         e.preventDefault()
         return  if @chatHistory.length == 0

      candidates = candidates.filter (name) ->
        name[...length].toLowerCase() == possibleName.toLowerCase()
      return  if candidates.length == 0
      @tabCompleteIndex = 0
      @tabCompleteNames = candidates
      @tabCompletePrefix = rest
      @tabCompleteCursorIndex = cursorIndex

    delete @chatHistoryIndex
    $this.val('')

  tabComplete: ($input, options = {}) =>
    cursorIndex = $input.prop('selectionStart')
    text = $input.val()
    if @tabCompleteNames.length > 0 && @tabCompleteCursorIndex == cursorIndex
      if options.reverse
        @tabCompleteIndex = (@tabCompleteIndex + 1) % @tabCompleteNames.length
      else
        @tabCompleteIndex -= 1
        if @tabCompleteIndex < 0
          @tabCompleteIndex = @tabCompleteNames.length - 1
    else
      delete @tabCompleteCursorIndex
      pieces = text[0...cursorIndex].split(' ')
