aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee14
1 files changed, 10 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index a9bf30a3..1406b1e7 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -396,10 +396,16 @@ extend window,
visibleInputs[selectedInputIndex].element.focus()
@suppressEvent
else unless event.keyCode == KeyboardUtils.keyCodes.shiftKey
- @exit event
- # In @exit(), we just pushed a new mode (usually insert mode). Restart bubbling, so that the
- # new mode can now see the event too.
- @restartBubbling
+ mode = @exit event
+ if mode
+ # In @exit(), we just pushed a new mode (usually insert mode). Restart bubbling, so that the
+ # new mode can now see the event too.
+ # Exception: If the new mode exits on Escape, and this key event is Escape, then rebubbling the
+ # event will just cause the mode to exit immediately. So we suppress Escapes.
+ if mode.options.exitOnEscape and KeyboardUtils.isEscape event
+ @suppressEvent
+ else
+ @restartBubbling
visibleInputs[selectedInputIndex].element.focus()
return @exit() if visibleInputs.length == 1