   # * `event` A `KeyboardEvent` of type 'keydown'
   handleKeyboardEvent: (event) ->
     keystroke = @keystrokeForKeyboardEvent(event)
-
-    if @queuedKeystrokes.length > 0 and isAtomModifier(keystroke)
+    keystroke = "^#{keystroke}" if event.type is 'keyup'
+
+    if event.type isnt 'keyup' and @queuedKeystrokes.length > 0 and isAtomModifier(keystroke)
       event.preventDefault()
       return
 
-    if event.type is 'keyup'
-      keystrokes = "#{@lastKeydownKeystrokes}^#{keystroke}"
-    else
-      @queuedKeyboardEvents.push(event)
-      @queuedKeystrokes.push(keystroke)
-      keystrokes = @queuedKeystrokes.join(' ')
-      @lastKeydownKeystrokes = keystrokes
+    @queuedKeyboardEvents.push(event)
+    @queuedKeystrokes.push(keystroke)
+    keystrokes = @queuedKeystrokes.join(' ')
 
     # If the event's target is document.body, assign it to defaultTarget instead
     # to provide a catch-all element when nothing is focused.

{Emitter, Disposable, CompositeDisposable} = require 'event-kit'
KeyBinding = require './key-binding'
CommandEvent = require './command-event'
{normalizeKeystrokes, keystrokeForKeyboardEvent, isAtomModifier, keydownEvent, keyupEvent, characterForKeyboardEvent} = require './helpers'

Platforms = ['darwin', 'freebsd', 'linux', 'sunos', 'win32']
OtherPlatforms = Platforms.filter (platform) -> platform isnt process.platform


  # Finds all key bindings whose keystrokes match the given keystrokes. Returns
  # both partial and exact matches.
  findMatchCandidates: (keystrokeArray) ->
    partialMatchCandidates = []
    exactMatchCandidates = []

    for binding in @keyBindings when binding.enabled
      doesMatch = keystrokesMatch(binding.keystrokeArray, keystrokeArray)
      if doesMatch is 'exact'
        exactMatchCandidates.push(binding)
      else if doesMatch is 'partial'
        partialMatchCandidates.push(binding)
    {partialMatchCandidates, exactMatchCandidates}

