aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts
diff options
context:
space:
mode:
authorStephen Blott2015-01-06 13:56:48 +0000
committerStephen Blott2015-01-06 13:56:48 +0000
commit914d689f8b4414dd65ed70b7b5ff86973fe8994a (patch)
treea5e610dec9a3b95c25ec7b0b89bd24846e33c456 /content_scripts
parent486dce36493836461de7e9ae73721230ad69a1b5 (diff)
downloadvimium-914d689f8b4414dd65ed70b7b5ff86973fe8994a.tar.bz2
Modes; also fix #1415 for <Enter> and the like.
Diffstat (limited to 'content_scripts')
-rw-r--r--content_scripts/vimium_frontend.coffee20
1 files changed, 12 insertions, 8 deletions
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