diff options
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/link_hints.coffee | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/content_scripts/link_hints.coffee b/content_scripts/link_hints.coffee index b5fc974f..dba55c9d 100644 --- a/content_scripts/link_hints.coffee +++ b/content_scripts/link_hints.coffee @@ -22,8 +22,11 @@ LinkHints = activateMode: (count = 1, mode = OPEN_IN_CURRENT_TAB) -> if 0 < count new LinkHintsMode mode, (event = null) -> - unless event?.type == "keydown" and KeyboardUtils.isEscape event - LinkHints.activateMode count-1, mode + # Escape and Backspace are the two ways in which hints mode can exit following which we do no restart + # hints mode. + return if event?.type == "keydown" and KeyboardUtils.isEscape event + return if event?.type == "keydown" and event.keyCode in [ keyCodes.backspace, keyCodes.deleteKey ] + LinkHints.activateMode count-1, mode activateModeToOpenInNewTab: (count) -> @activateMode count, OPEN_IN_NEW_BG_TAB activateModeToOpenInNewForegroundTab: (count) -> @activateMode count, OPEN_IN_NEW_FG_TAB @@ -328,7 +331,9 @@ class LinkHintsMode if @markerMatcher.popKeyChar() @updateVisibleMarkers hintMarkers else - @deactivateMode() + # Exit via @hintMode.exit(), so that the LinkHints.activate() "onExit" callback sees the key event and + # knows not to restart hints mode. + @hintMode.exit event else if event.keyCode == keyCodes.enter # Activate the active hint, if there is one. Only FilterHints uses an active hint. |
