diff options
| author | Stephen Blott | 2016-02-01 05:57:27 +0000 |
|---|---|---|
| committer | Stephen Blott | 2016-02-01 05:57:27 +0000 |
| commit | da006481be45d58972982aac44d372450204e6fa (patch) | |
| tree | f3f7c8340fc624777f6d588ae20d0bf822ded016 | |
| parent | d3f83fbe03d80d77f20d364f7b5e6e52260f516f (diff) | |
| download | vimium-da006481be45d58972982aac44d372450204e6fa.tar.bz2 | |
Use a count with link hints; exit on Backspace.
Normally, `Backspace` exits hints mode. It should exit hint mode with a
count too.
| -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. |
