diff options
| -rw-r--r-- | content_scripts/mode.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/mode_insert.coffee | 2 | ||||
| -rw-r--r-- | content_scripts/mode_passkeys.coffee | 4 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 7 | ||||
| -rw-r--r-- | lib/handler_stack.coffee | 8 |
5 files changed, 9 insertions, 14 deletions
diff --git a/content_scripts/mode.coffee b/content_scripts/mode.coffee index 88938e79..82dbf74a 100644 --- a/content_scripts/mode.coffee +++ b/content_scripts/mode.coffee @@ -40,7 +40,7 @@ class Mode if type == "keydown" and KeyboardUtils.isEscape event @exit() return Mode.suppressPropagation - handlerStack.passThrough + handlerStack.passDirectlyToPage # Generate a default handler which always suppresses propagation; except Esc, which pops the current mode. generateSuppressPropagation: (type) -> diff --git a/content_scripts/mode_insert.coffee b/content_scripts/mode_insert.coffee index 4a1d4349..4ef490c9 100644 --- a/content_scripts/mode_insert.coffee +++ b/content_scripts/mode_insert.coffee @@ -27,7 +27,7 @@ class InsertMode extends Mode generateKeyHandler: (type) -> (event) => return Mode.propagate unless @isActive() - return handlerStack.passThrough unless type == "keydown" and KeyboardUtils.isEscape event + return handlerStack.passDirectlyToPage unless type == "keydown" and KeyboardUtils.isEscape event # We're now exiting insert mode. if @canEditElement event.srcElement # Remove the focus so the user can't just get himself back into insert mode by typing in the same input diff --git a/content_scripts/mode_passkeys.coffee b/content_scripts/mode_passkeys.coffee index 7a0249ad..ce9f25d2 100644 --- a/content_scripts/mode_passkeys.coffee +++ b/content_scripts/mode_passkeys.coffee @@ -11,8 +11,8 @@ class PassKeysMode extends Mode handlePassKeyEvent: (event) -> for keyChar in [KeyboardUtils.getKeyChar(event), String.fromCharCode(event.charCode)] - # A key is passed through to the underlying page by returning handlerStack.passThrough. - return handlerStack.passThrough if keyChar and @isPassKey keyChar + # A key is passed through to the underlying page by returning handlerStack.passDirectlyToPage. + return handlerStack.passDirectlyToPage if keyChar and @isPassKey keyChar true setState: (response) -> diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 409cf96b..59404247 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -123,11 +123,6 @@ initializePreDomReady = -> # immediately above normal mode. Scroller.init settings - handlePassKeyEvent = (event) -> - for keyChar in [ KeyboardUtils.getKeyChar(event), String.fromCharCode(event.charCode) ] - return handlerStack.passThrough if keyChar and isPassKey keyChar - true - # Install passKeys and insert modes. These too are permanently on the stack (although not always active). passKeysMode = new PassKeysMode() insertMode = new InsertMode() @@ -444,7 +439,7 @@ onKeypress = (event) -> DomUtils.suppressEvent(event) else if (!isInsertMode() && !findMode) if (isPassKey keyChar) - return handlerStack.passThrough + return handlerStack.passDirectlyToPage if (currentCompletionKeys.indexOf(keyChar) != -1 or isValidFirstKey(keyChar)) DomUtils.suppressEvent(event) diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index 6f599dc7..8929fa53 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -5,7 +5,7 @@ class HandlerStack constructor: -> @stack = [] @counter = 0 - @passThrough = new Object() # Used only as a constant, distinct from any other value. + @passDirectlyToPage = new Object() # Used only as a constant, distinct from any other value. genId: -> @counter = ++@counter @@ -28,9 +28,9 @@ class HandlerStack if not passThrough DomUtils.suppressEvent(event) return false - # If the constant @passThrough is returned, then discontinue further bubbling and pass the event - # through to the underlying page. The event is not suppresssed. - if passThrough == @passThrough + # If the constant @passDirectlyToPage is returned, then discontinue further bubbling and pass the + # event through to the underlying page. The event is not suppresssed. + if passThrough == @passDirectlyToPage return false true |
