       when 'open' then 'close'
       when 'close' then 'open'
 
-    @editor[scanFunctionName] @pattern, scanRange, (event) =>
+    @editor[scanFunctionName] @getPattern(), scanRange, (event) =>
       if not @allowNextLine and (from.row isnt event.range.start.row)
         event.stop()
         return

      if @filters.some((filter) -> filter(event))
        return

      tagState = getTagState(event)
      if tagState.state is oppositeState
        stack.push(tagState)
      else

  getFinder: (from) ->
    filters = @getFilters()
    allowNextLine = @isAllowNextLine()
    options = {@editor, from, filters, allowNextLine}

    if @pair[0] is @pair[1]
      finder = new QuoteFinder(options)
    else
      finder = new BracketFinder(options)

    finder.setPatternForPair(@pair)
    finder

  getPairInfo: (from) ->
    finder = @getFinder(from)
