diff options
| -rw-r--r-- | content_scripts/mode_find.coffee | 22 | ||||
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 22 | 
2 files changed, 22 insertions, 22 deletions
| diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee index 54c8438a..e65450f2 100644 --- a/content_scripts/mode_find.coffee +++ b/content_scripts/mode_find.coffee @@ -132,6 +132,28 @@ class FindMode extends Mode        text = document.body.innerText        findModeQuery.matchCount = text.match(pattern)?.length +window.getNextQueryFromRegexMatches = (stepSize) -> +  # find()ing an empty query always returns false +  return "" unless findModeQuery.regexMatches + +  totalMatches = findModeQuery.regexMatches.length +  findModeQuery.activeRegexIndex += stepSize + totalMatches +  findModeQuery.activeRegexIndex %= totalMatches + +  findModeQuery.regexMatches[findModeQuery.activeRegexIndex] + +window.getFindModeQuery = (backwards) -> +  # check if the query has been changed by a script in another frame +  mostRecentQuery = FindModeHistory.getQuery() +  if (mostRecentQuery != findModeQuery.rawQuery) +    findModeQuery.rawQuery = mostRecentQuery +    FindMode.updateQuery() + +  if findModeQuery.isRegex +    getNextQueryFromRegexMatches(if backwards then -1 else 1) +  else +    findModeQuery.parsedQuery +  getCurrentRange = ->    selection = getSelection()    if selection.type == "None" diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 13e07e7a..80da43bb 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -677,28 +677,6 @@ selectFoundInputElement = ->        DomUtils.isDOMDescendant(findModeAnchorNode, document.activeElement))      DomUtils.simulateSelect(document.activeElement) -window.getNextQueryFromRegexMatches = (stepSize) -> -  # find()ing an empty query always returns false -  return "" unless findModeQuery.regexMatches - -  totalMatches = findModeQuery.regexMatches.length -  findModeQuery.activeRegexIndex += stepSize + totalMatches -  findModeQuery.activeRegexIndex %= totalMatches - -  findModeQuery.regexMatches[findModeQuery.activeRegexIndex] - -window.getFindModeQuery = (backwards) -> -  # check if the query has been changed by a script in another frame -  mostRecentQuery = FindModeHistory.getQuery() -  if (mostRecentQuery != findModeQuery.rawQuery) -    findModeQuery.rawQuery = mostRecentQuery -    FindMode.updateQuery() - -  if findModeQuery.isRegex -    getNextQueryFromRegexMatches(if backwards then -1 else 1) -  else -    findModeQuery.parsedQuery -  findAndFocus = (backwards) ->    Marks.setPreviousPosition()    query = getFindModeQuery backwards | 
