aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-27 16:36:49 +0000
committerStephen Blott2015-01-27 16:36:54 +0000
commita982ce074d517eb9e56c517d86a4bfb3869cf171 (patch)
tree372a3cf5f96238e223cb91eccdfa56923e8fe854 /content_scripts/vimium_frontend.coffee
parent9d97ce8dab7672d7d1846f7cbe4d22af80c91b01 (diff)
downloadvimium-a982ce074d517eb9e56c517d86a4bfb3869cf171.tar.bz2
Visual/edit modes: minor changes.
- Minor changes. - Deactivate modes on inputs from focusInput().
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee10
1 files changed, 6 insertions, 4 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 55237fe5..d1da9524 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -350,7 +350,7 @@ extend window,
# Focus the first input element on the page, and create overlays to highlight all the input elements, with
# the currently-focused element highlighted specially. Tabbing will shift focus to the next input element.
# Pressing any other key will remove the overlays and the special tab behavior.
- # If mode is provided, then enter that mode on exit. Otherwise, just let insert mode take over.
+ # The mode argument is the mode to enter once an input is selected.
resultSet = DomUtils.evaluateXPath textInputXPath, XPathResult.ORDERED_NODE_SNAPSHOT_TYPE
visibleInputs =
for i in [0...resultSet.snapshotLength] by 1
@@ -386,9 +386,6 @@ extend window,
super
name: "focus-selector"
badge: "?"
- # We share a singleton with PostFindMode. That way, a new FocusSelector displaces any existing
- # PostFindMode.
- singleton: PostFindMode
exitOnClick: true
keydown: (event) =>
if event.keyCode == KeyboardUtils.keyCodes.tab
@@ -396,6 +393,8 @@ extend window,
selectedInputIndex += hints.length + (if event.shiftKey then -1 else 1)
selectedInputIndex %= hints.length
hints[selectedInputIndex].classList.add 'internalVimiumSelectedInputHint'
+ # Deactivate any other modes on this element.
+ @deactivateSingleton visibleInputs[selectedInputIndex].element
visibleInputs[selectedInputIndex].element.focus()
@suppressEvent
else unless event.keyCode == KeyboardUtils.keyCodes.shiftKey
@@ -407,9 +406,12 @@ extend window,
id: "vimiumInputMarkerContainer"
className: "vimiumReset"
+ # Deactivate any other modes on this element.
+ @deactivateSingleton visibleInputs[selectedInputIndex].element
visibleInputs[selectedInputIndex].element.focus()
if visibleInputs.length == 1
@exit()
+ return
else
hints[selectedInputIndex].classList.add 'internalVimiumSelectedInputHint'