diff options
| author | Jez Ng | 2012-10-20 23:17:30 -0400 | 
|---|---|---|
| committer | Jez Ng | 2012-10-20 23:17:45 -0400 | 
| commit | ea73be17468b1bd02171c82e1fb21b1bc16ccd0e (patch) | |
| tree | 223e4a3b56a410f599e19f81b38752ded86d44c6 /content_scripts/link_hints.coffee | |
| parent | 2ed217b43663a553c78fa08a8a10152a43e93cf5 (diff) | |
| download | vimium-ea73be17468b1bd02171c82e1fb21b1bc16ccd0e.tar.bz2 | |
Refactor handlerStack. Closes #657.
Previously, handlerStack was designed only for removal of the handler
right at the top of the stack. However, some handlers sought to remove
themselves when they were not at the top of the stack, creating
confusion. The new handlerStack ensures that such removal can always be
done safely.
Diffstat (limited to 'content_scripts/link_hints.coffee')
| -rw-r--r-- | content_scripts/link_hints.coffee | 6 | 
1 files changed, 3 insertions, 3 deletions
| diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index a47f9263..7faa1a65 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -63,7 +63,7 @@ LinkHints =        { id: "vimiumHintMarkerContainer", className: "vimiumReset" })      # handlerStack is declared by vimiumFrontend.js -    handlerStack.push({ +    @handlerId = handlerStack.push({        keydown: @onKeyDownInMode.bind(this, hintMarkers),        # trap all key events        keypress: -> false @@ -163,7 +163,7 @@ LinkHints =          keyup: (event) ->            return if (event.keyCode != keyCodes.shiftKey)            LinkHints.setOpenLinkMode(!LinkHints.shouldOpenInNewTab, LinkHints.shouldOpenWithQueue, false) -          handlerStack.pop() +          @remove()        })      # TODO(philc): Ignore keys that have modifiers. @@ -231,7 +231,7 @@ LinkHints =        if (LinkHints.hintMarkerContainingDiv)          DomUtils.removeElement LinkHints.hintMarkerContainingDiv        LinkHints.hintMarkerContainingDiv = null -      handlerStack.pop() +      handlerStack.remove @handlerId        HUD.hide()        @isActive = false | 
