aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorStephen Blott2015-01-08 07:20:55 +0000
committerStephen Blott2015-01-08 07:25:21 +0000
commit7c886d32cca6c0540a9ec6247eb1617b8f1db86a (patch)
tree089eb79c280765c61e9b01d297c470709555b2bc /lib
parent8cbe2df33d8af3845801bfaacf3b58adab9916cb (diff)
downloadvimium-7c886d32cca6c0540a9ec6247eb1617b8f1db86a.tar.bz2
Modes; refactor PostFindMode key handling.
In particular, this refactors the handling of non-vimium key events in PostFindMode. This implements option 2 from #1415. However, #1415 is not resolved, and option 3 remains a viable option.
Diffstat (limited to 'lib')
-rw-r--r--lib/handler_stack.coffee12
1 files changed, 9 insertions, 3 deletions
diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee
index 4d186341..718bee9d 100644
--- a/lib/handler_stack.coffee
+++ b/lib/handler_stack.coffee
@@ -14,11 +14,17 @@ class HandlerStack
# processing should take place.
@stopBubblingAndFalse = new Object()
- # Adds a handler to the stack. Returns a unique ID for that handler that can be used to remove it later.
+ # Adds a handler to the top of the stack. Returns a unique ID for that handler that can be used to remove it
+ # later.
push: (handler) ->
- handler.id = ++@counter
@stack.push handler
- handler.id
+ handler.id = ++@counter
+
+ # Adds a handler to the bottom of the stack. Returns a unique ID for that handler that can be used to remove
+ # it later.
+ unshift: (handler) ->
+ @stack.unshift handler
+ handler.id = ++@counter
# Called whenever we receive a key or other event. Each individual handler has the option to stop the
# event's propagation by returning a falsy value, or stop bubbling by returning @stopBubblingAndFalse or