aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-01-06 05:01:59 +0000
committerStephen Blott2015-01-06 05:01:59 +0000
commitff2aaea99ef2852aa607d47c9fc6387099c92da1 (patch)
tree4129af88764c107aed4660805e3faf0840f15d3f
parent94586418ffd92246551c26ff00f0d80b0e2289fa (diff)
downloadvimium-ff2aaea99ef2852aa607d47c9fc6387099c92da1.tar.bz2
Modes; simplify focusInput.
-rw-r--r--content_scripts/vimium_frontend.coffee20
1 files changed, 9 insertions, 11 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 82beb90c..1c562216 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -359,15 +359,6 @@ extend window,
selectedInputIndex = Math.min(count - 1, visibleInputs.length - 1)
- # If PostFindMode is active, then the target element may already have the focus, in which case, .focus()
- # will not generate a "focus" event to trigger insert mode. So we handle insert mode manually, here.
- Mode.runIn InsertModeBlocker, ->
- visibleInputs[selectedInputIndex].element.focus()
-
- if visibleInputs.length == 1
- new InsertMode visibleInputs[selectedInputIndex].element
- return
-
hints = for tuple in visibleInputs
hint = document.createElement("div")
hint.className = "vimiumReset internalVimiumInputHint vimiumInputHint"
@@ -400,8 +391,15 @@ extend window,
false
else unless event.keyCode == KeyboardUtils.keyCodes.shiftKey
@exit()
- DomUtils.removeElement hintContainingDiv
- new InsertMode visibleInputs[selectedInputIndex].element
+
+ visibleInputs[selectedInputIndex].element.focus()
+ @exit() if visibleInputs.length == 1
+
+ exit: ->
+ DomUtils.removeElement hintContainingDiv
+ new InsertMode visibleInputs[selectedInputIndex].element
+ super()
+ @continueBubbling
# Decide whether this keyChar should be passed to the underlying page.
# Keystrokes are *never* considered passKeys if the keyQueue is not empty. So, for example, if 't' is a