   spliceStack: (stack, eventState) ->
     stack.pop()
 
+  onCloseFound: (stack, {eventState, from}) ->
+    openState = @spliceStack(stack, eventState)
+    unless openState?
+      return true
+
+    if stack.length is 0
+      {start} = openState.range
+      start.isEqual(from) or (@allowForwarding and start.row is from.row)
+
+  onOpenFound: (stack, {eventState, from}) ->
+    @spliceStack(stack, eventState)
+    stack.length is 0
+
   findCloseForward: (from) ->
-    @findPair 'close', 'forward', from, (stack, closeState) =>
-      openState = @spliceStack(stack, closeState)
-      unless openState?
-        return true
-
-      if stack.length is 0
-        {start} = openState.range
-        start.isEqual(from) or (@allowForwarding and start.row is from.row)
+    @findPair('close', 'forward', from)
 
   findOpenBackward: (from) ->
-    @findPair 'open', 'backward', from, (stack, openState) =>
-      @spliceStack(stack, openState)
-      stack.length is 0
+    @findPair('open', 'backward', from)
 
   find: (from) ->
-    closeRange = @findCloseForward(from)
-    if closeRange?
-      @closeRange = closeRange
-      openRange = @findOpenBackward(closeRange.end)
+    closeRange = @closeRange = @findCloseForward(from)
+    openRange = @findOpenBackward(closeRange.end) if closeRange?
 
     if closeRange? and openRange?
       {

_ = require 'underscore-plus'
{
  isEscapedCharRange
  scanBufferRow
} = require './utils'


    # it is forwarding pair, so stoppable is not @allowForwarding
    findingNonForwardingClosingQuote = (this instanceof QuoteFinder) and which is 'close' and not @allowForwarding

    @editor[functionName] pattern, scanRange, (event) =>
      return if isEscapedCharRange(@editor, event.range)
      return unless @filterEvent(event)

      eventState = @getEventState(event)

      if eventState.state isnt which
