aboutsummaryrefslogtreecommitdiffstats
path: root/content_scripts/vimium_frontend.coffee
diff options
context:
space:
mode:
authorStephen Blott2015-01-07 11:29:24 +0000
committerStephen Blott2015-01-07 16:38:50 +0000
commit0429da577097bd7d30d12901fcc74385e44d83f4 (patch)
tree2b307ac9f28273a2f93623724877e766b9f7745c /content_scripts/vimium_frontend.coffee
parent04ac4c64c9634d9f81035ff7e9db537f39b42f3c (diff)
downloadvimium-0429da577097bd7d30d12901fcc74385e44d83f4.tar.bz2
Modes; Continue incorporation of comments in #1413.
- Slight rework of HandlerStack. - Remove classs ExitOnEscape and ExitOnBlur - Rework InsertMode, plus trigger and blocker. - Remove StateMode. - Do no mixin options. - Lots of tidy up (including set a debug variable to Mode).
Diffstat (limited to 'content_scripts/vimium_frontend.coffee')
-rw-r--r--content_scripts/vimium_frontend.coffee13
1 files changed, 7 insertions, 6 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 193a1592..f0196c74 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -469,7 +469,7 @@ onKeypress = (event, extra) ->
keyPort.postMessage({ keyChar:keyChar, frameId:frameId })
- if InsertModeBlocker.isActive extra
+ if InsertModeTrigger.isDisabled extra
# If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input
# element. So we should also block other keystrokes (otherwise, it's weird). There's some controversy as
# to whether this is the right thing to do. See discussion in #1415.
@@ -568,7 +568,7 @@ onKeydown = (event, extra) ->
isValidFirstKey(KeyboardUtils.getKeyChar(event))))
DomUtils.suppressPropagation(event)
KeydownEvents.push event
- else if InsertModeBlocker.isActive extra
+ else if InsertModeTrigger.isDisabled extra
# If PostFindMode is active, then we're blocking vimium's keystrokes from going into an input
# element. So we should also block other keystrokes (otherwise, it's weird). There's some controversy as
# to whether this is the right thing to do. See discussion in #1415.
@@ -747,11 +747,12 @@ handleEnterForFindMode = ->
document.body.classList.add("vimiumFindMode")
settings.set("findModeRawQuery", findModeQuery.rawQuery)
-class FindMode extends ExitOnEscapeMode
+class FindMode extends Mode
constructor: ->
- super FindMode,
+ super
name: "find"
badge: "/"
+ exitOnEscape: true
keydown: (event) =>
if event.keyCode == keyCodes.backspace || event.keyCode == keyCodes.deleteKey
@@ -773,9 +774,9 @@ class FindMode extends ExitOnEscapeMode
keyup: (event) => @suppressEvent
- exit: (extra) ->
- handleEscapeForFindMode() if extra?.source == ExitOnEscapeMode
+ exit: (event) ->
super()
+ handleEscapeForFindMode() if event and KeyboardUtils.isEscape event
new PostFindMode findModeAnchorNode
performFindInPlace = ->