aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-10-01 06:21:14 +0100
committerStephen Blott2016-10-01 06:25:00 +0100
commitfb876164338e865144402689b159e4edf35cf777 (patch)
treebfcd2a41ed3888a0c975b45e3a6dc86adb1bee1d
parent59942281ce88283345a201f1bfaa76b628308472 (diff)
downloadvimium-fb876164338e865144402689b159e4edf35cf777.tar.bz2
Fix find-mode hangs.
"/" followed immediately by "i" can hang Vimium. The problem is that launching find mode is asynchronous (we wait until the HUD is available). Because normal mode is still active, we can enter insert mode *before* the find-mode HUD receives the focus. The result is that we end up in both find mode and insert mode, the HUD has the focus, but the HUD is in insert mode, so it ignores keyboard events (including `Escape`). The only way out is to click the page's body and then type `Escape`. This commit demonstrates the problem: 7d2b00411eae3293fa4c7b1f61b384c0c495b5a2. This happens in practice, for example while a busy page is loading. This commit fixes this by ensuring that find-mode blocks keyboard events immediately (and synchronously) on launch.
-rw-r--r--content_scripts/mode_find.coffee4
1 files changed, 4 insertions, 0 deletions
diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee
index 4c146889..8621edf8 100644
--- a/content_scripts/mode_find.coffee
+++ b/content_scripts/mode_find.coffee
@@ -71,6 +71,10 @@ class FindMode extends Mode
name: "find"
indicator: false
exitOnClick: true
+ exitOnEscape: true
+ # This prevents further Vimium commands launching before the find-mode HUD receives the focus.
+ # E.g. "/" followed quickly by "i" should not leave us in insert mode.
+ suppressAllKeyboardEvents: true
HUD.showFindMode this