 # consists of a (non-empty) list of such mappings.
 
 class KeyHandlerMode extends (window.Mode || global.Mode)
-  setKeyMapping: (@keyMapping) -> @reset()
-  setPassKeys: (@passKeys) -> @reset()
+  setKeyMapping: (@keyMapping) -> @reset(); return
+  setPassKeys: (@passKeys) -> @reset(); return
+
   # Only for tests.
   setCommandHandler: (@commandHandler) ->
 
   # Reset the key state, optionally retaining the count provided.
   reset: (@countPrefix = 0) ->
     @keyState = [@keyMapping]
+    return
 
   init: (options) ->
     args = extend(options, keydown: @onKeydown.bind(this))
     super.init(args)
 
-    @commandHandler = options.commandHandler ? (->)
-    @setKeyMapping options.keyMapping ? {}
+    @commandHandler = options.commandHandler || (->)
+    @setKeyMapping options.keyMapping || {}
 
     if options.exitOnEscape
       # If we're part way through a command's key sequence, then a first Escape should reset the key state,


  # This tests whether there is a mapping of keyChar in the current key state (and accounts for pass keys).
  isMappedKey: (keyChar) ->
    (mapping for mapping in @keyState when keyChar of mapping)[0]? and not @isPassKey keyChar

  # This tests whether keyChar is a digit (and accounts for pass keys).
  isCountKey: (keyChar) ->
    keyChar and (if 0 < @countPrefix then '0' else '1') <= keyChar <= '9' and not @isPassKey keyChar

  # Keystrokes are *never* considered pass keys if the user has begun entering a command.  So, for example, if
  # 't' is a passKey, then the "t"-s of 'gt' and '99t' are neverthless handled as regular keys.

    if isEscape and (@countPrefix != 0 or @keyState.length != 1)
      DomUtils.consumeKeyup event, => @reset()
    # If the help dialog loses the focus, then Escape should hide it; see point 2 in #2045.
    else if isEscape and HelpDialog and HelpDialog.isShowing()
      HelpDialog.toggle()
      @suppressEvent
    else if isEscape
