From 24c53c33ea8b4b603db91bc68fd3b7e50d7b5615 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 3 Jun 2015 03:34:34 +0100 Subject: Integrate performFindInPlace into FindMode as findInPlace --- content_scripts/hud.coffee | 2 +- content_scripts/vimium_frontend.coffee | 14 +++++++------- 2 files changed, 8 insertions(+), 8 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/hud.coffee b/content_scripts/hud.coffee index ca2eb7f2..4535ba69 100644 --- a/content_scripts/hud.coffee +++ b/content_scripts/hud.coffee @@ -38,7 +38,7 @@ HUD = window.scrollTo findMode.scrollX, findMode.scrollY if findMode.options.returnToViewport findModeQuery.rawQuery = data.query updateFindModeQuery() - performFindInPlace() + findMode.findInPlace() showFindModeHUDForQuery() # Hide the HUD. diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 633e4122..9e4d2ab3 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -688,7 +688,7 @@ window.handleEnterForFindMode = -> class FindMode extends Mode constructor: (@options = {}) -> - # Save the selection, so performFindInPlace can restore it. + # Save the selection, so findInPlace can restore it. @initialRange = getCurrentRange() window.findModeQuery = rawQuery: "" if @options.returnToViewport @@ -711,12 +711,12 @@ class FindMode extends Mode selection.removeAllRanges() selection.addRange range -window.performFindInPlace = -> - # Restore the selection. That way, we're always searching forward from the same place, so we find the right - # match as the user adds matching characters, or removes previously-matched characters. See #1434. - findMode.restoreSelection() - query = if findModeQuery.isRegex then getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery - window.findModeQueryHasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase }) + findInPlace: -> + # Restore the selection. That way, we're always searching forward from the same place, so we find the right + # match as the user adds matching characters, or removes previously-matched characters. See #1434. + @restoreSelection() + query = if findModeQuery.isRegex then getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery + window.findModeQueryHasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase }) # :options is an optional dict. valid parameters are 'caseSensitive' and 'backwards'. executeFind = (query, options) -> -- cgit v1.2.3