aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2016-01-09 08:37:54 +0000
committerStephen Blott2016-01-09 08:37:54 +0000
commitacfa129451afbf32dbcad4bad902085e39e60842 (patch)
tree9ab718346d0b88d12199d24d1c80df7978f000ca
parentcd2aff1a9f787c3def235831eae88e181c8f7f3e (diff)
downloadvimium-acfa129451afbf32dbcad4bad902085e39e60842.tar.bz2
Ensure hint handler is always removed.
For some (unknown) reason, we do not receive the keyup event for Shift when activating link hints. Consequently, we are not correctly removing the keyup handler. And that handler is blocking subsequent keyup events, which has the effect of endless scrolling (because the scroller relies on keyup events to stop scrolling). Here, we correcttly remove the keyup handler when link-hints mode exits. Fixes #1911.
-rw-r--r--content_scripts/link_hints.coffee7
1 files changed, 6 insertions, 1 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee
index bf120629..8fc1446b 100644
--- a/content_scripts/link_hints.coffee
+++ b/content_scripts/link_hints.coffee
@@ -304,11 +304,16 @@ class LinkHintsMode
when keyCodes.ctrlKey
@setOpenLinkMode(if @mode is OPEN_IN_NEW_FG_TAB then OPEN_IN_NEW_BG_TAB else OPEN_IN_NEW_FG_TAB)
- handlerStack.push
+ handlerId = handlerStack.push
keyup: (event) =>
if event.keyCode == keyCode
handlerStack.remove()
@setOpenLinkMode previousMode if @isActive
+ true # Continue bubbling the event.
+
+ # For some (unknown) reason, we don't always receive the keyup event needed to remove this handler.
+ # Therefore, we ensure that it's always removed when hint mode exits. See #1911 and #1926.
+ @hintMode.onExit -> handlerStack.remove handlerId
else if event.keyCode in [ keyCodes.backspace, keyCodes.deleteKey ]
if @markerMatcher.popKeyChar()