aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-01-02 11:09:25 +0000
committerStephen Blott2015-01-02 11:09:25 +0000
commit6d471844497ff35b83296d7da34830288696f029 (patch)
tree54f82a750d76d7fe07d1d04a1010fc2e68272d07
parent20ebbf3de2384738af916a441470d74a5aca14a3 (diff)
downloadvimium-6d471844497ff35b83296d7da34830288696f029.tar.bz2
Modes; temporary hack to fix find mode.
-rw-r--r--content_scripts/mode_passkeys.coffee3
-rw-r--r--content_scripts/vimium_frontend.coffee12
2 files changed, 10 insertions, 5 deletions
diff --git a/content_scripts/mode_passkeys.coffee b/content_scripts/mode_passkeys.coffee
index 82f7596b..6320c698 100644
--- a/content_scripts/mode_passkeys.coffee
+++ b/content_scripts/mode_passkeys.coffee
@@ -7,6 +7,9 @@ class PassKeysMode extends Mode
# passKeys if the keyQueue is not empty. So, for example, if 't' is a passKey, then 'gt' and '99t' will
# neverthless be handled by vimium.
isPassKey: (keyChar) ->
+ # FIXME(smblott). Temporary hack: attach findMode to the window (so passKeysMode can see it). This will be
+ # fixed when find mode is rationalized or #1401 is merged.
+ return false if window.findMode
not @keyQueue and 0 <= @passKeys.indexOf(keyChar)
handlePassKeyEvent: (event) ->
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 3ce4169d..09e775a6 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -8,7 +8,9 @@
insertMode = null
passKeysMode = null
insertModeLock = null
-findMode = false
+# FIXME(smblott). Temporary hack: attach findMode to the window (so passKeysMode can see it). This will be
+# fixed when find mode is rationalized or #1401 is merged.
+window.findMode = false
findModeQuery = { rawQuery: "", matchCount: 0 }
findModeQueryHasResults = false
findModeAnchorNode = null
@@ -743,7 +745,7 @@ executeFind = (query, options) ->
# rather hacky, but this is our way of signalling to the insertMode listener not to react to the focus
# changes that find() induces.
oldFindMode = findMode
- findMode = true
+ window.findMode = true # Same hack, see comment at window.findMode definition.
document.body.classList.add("vimiumFindMode")
@@ -756,7 +758,7 @@ executeFind = (query, options) ->
-> document.addEventListener("selectionchange", restoreDefaultSelectionHighlight, true)
0)
- findMode = oldFindMode
+ window.findMode = oldFindMode # Same hack, see comment at window.findMode definition.
# we need to save the anchor node here because <esc> seems to nullify it, regardless of whether we do
# preventDefault()
findModeAnchorNode = document.getSelection().anchorNode
@@ -949,11 +951,11 @@ showFindModeHUDForQuery = ->
window.enterFindMode = ->
findModeQuery = { rawQuery: "" }
- findMode = true
+ window.findMode = true # Same hack, see comment at window.findMode definition.
HUD.show("/")
exitFindMode = ->
- findMode = false
+ window.findMode = false # Same hack, see comment at window.findMode definition.
HUD.hide()
window.showHelpDialog = (html, fid) ->