             else
               return if openStart.isGreaterThan(from)
           found = range
-          return stop()
+      stop() if found?
     found
 
   getPairInfo: (from) ->

  getRange: (selection, @allowForwarding=@allowForwarding) ->
    originalRange = selection.getBufferRange()
    from = selection.getTailBufferPosition()
    pairInfo = @getPairInfo(from)
    # When range was same, try to expand range
    if pairInfo?.targetRange.isEqual(originalRange)

      {matchText, range, stop} = event
      [pairState, tagName] = @getPairState(event)
      if pairState is 'close'
        tagState = pairState + tagName
        stack.push({tagState, range})
      else
        if (index = @findLastIndexOfTagState(stack, "close#{tagName}")) >= 0
          stack = stack[0...index]
        if stack.length is 0
          found = range
      stop() if found?
    found

  findClose: (from,  pattern) ->
    scanFunc = 'scanInBufferRange'
