diff options
| author | Stephen Blott | 2015-01-04 16:19:14 +0000 | 
|---|---|---|
| committer | Stephen Blott | 2015-01-05 12:16:13 +0000 | 
| commit | 73f66f25e6b8e5b5b8456074ad4fa79ba1d3ca4d (patch) | |
| tree | 3cc98670418a886793f7c243e62026149dfbe0b9 /lib | |
| parent | 45b2674e461659327f8e41ba10035abddde29b26 (diff) | |
| download | vimium-73f66f25e6b8e5b5b8456074ad4fa79ba1d3ca4d.tar.bz2 | |
Modes; revise InsertMode as two classes.
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/handler_stack.coffee | 17 | 
1 files changed, 6 insertions, 11 deletions
| diff --git a/lib/handler_stack.coffee b/lib/handler_stack.coffee index 17e4844b..0a34087f 100644 --- a/lib/handler_stack.coffee +++ b/lib/handler_stack.coffee @@ -40,17 +40,12 @@ class HandlerStack      true    remove: (id = @currentId) -> -    if 0 < @stack.length and @stack[@stack.length-1].id == id -      # A common case is to remove the handler at the top of the stack.  And we can do this very efficiently. -      # Tests suggest that this case arises more than half of the time. -      @stack.pop().id = null -    else -      # Otherwise, we'll build a new stack.  This is better than splicing the existing stack since that can -      # interfere with concurrent bubbleEvents. -      @stack = @stack.filter (handler) -> -        # Mark this handler as removed (for any active bubbleEvent call). -        handler.id = null if handler.id == id -        handler?.id? +    # This is more expense than splicing @stack, but better because splicing can interfere with concurrent +    # bubbleEvents. +    @stack = @stack.filter (handler) -> +      # Mark this handler as removed (to notify any concurrent bubbleEvent call). +      if handler.id == id then handler.id = null +      handler?.id?    # The handler stack handles chrome events (which may need to be suppressed) and internal (fake) events.    # This checks whether that the event at hand is a chrome event. | 
