From 914d689f8b4414dd65ed70b7b5ff86973fe8994a Mon Sep 17 00:00:00 2001 From: Stephen Blott Date: Tue, 6 Jan 2015 13:56:48 +0000 Subject: Modes; also fix #1415 for and the like. --- content_scripts/vimium_frontend.coffee | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 07b430ba..24cc25c3 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -460,14 +460,16 @@ onKeypress = (event) -> else if (!isInsertMode() && !findMode) if (isPassKey keyChar) return handlerStack.stopBubblingAndTrue - if currentCompletionKeys.indexOf(keyChar) != -1 or isValidFirstKey(keyChar) or - # If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input - # element. So we should also block other keystrokes (otherwise, it's weird). - InsertModeBlocker.isActive() + if currentCompletionKeys.indexOf(keyChar) != -1 or isValidFirstKey(keyChar) DomUtils.suppressEvent(event) keyPort.postMessage({ keyChar:keyChar, frameId:frameId }) + if InsertModeBlocker.isActive() + # If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input + # element. So we should also block other keystrokes (otherwise, it's weird). + DomUtils.suppressEvent(event) + return true onKeydown = (event) -> @@ -558,10 +560,12 @@ onKeydown = (event) -> # TOOD(ilya): Revisit this. Not sure it's the absolute best approach. if (keyChar == "" && !isInsertMode() && (currentCompletionKeys.indexOf(KeyboardUtils.getKeyChar(event)) != -1 || - isValidFirstKey(KeyboardUtils.getKeyChar(event)) || - # If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input - # element. So we should also block other keystrokes (otherwise, it's weird). - InsertModeBlocker.isActive())) + isValidFirstKey(KeyboardUtils.getKeyChar(event)))) + DomUtils.suppressPropagation(event) + KeydownEvents.push event + else if InsertModeBlocker.isActive() + # If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input + # element. So we should also block other keystrokes (otherwise, it's weird). DomUtils.suppressPropagation(event) KeydownEvents.push event -- cgit v1.2.3