From d51bd435ecac2890e38bcb420ece5ada52c4fc21 Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Wed, 10 Jun 2015 16:30:26 +0100 Subject: Simplify executeFind by hardcoding default arguments --- content_scripts/mode_find.coffee | 2 +- content_scripts/vimium_frontend.coffee | 7 +++---- 2 files changed, 4 insertions(+), 5 deletions(-) (limited to 'content_scripts') diff --git a/content_scripts/mode_find.coffee b/content_scripts/mode_find.coffee index ad3d3408..a252193d 100644 --- a/content_scripts/mode_find.coffee +++ b/content_scripts/mode_find.coffee @@ -84,7 +84,7 @@ class FindMode extends Mode # match as the user adds matching characters, or removes previously-matched characters. See #1434. @restoreSelection() query = if findModeQuery.isRegex then FindMode.getNextQueryFromRegexMatches(0) else findModeQuery.parsedQuery - window.findModeQuery.hasResults = executeFind(query, { caseSensitive: !findModeQuery.ignoreCase }) + window.findModeQuery.hasResults = executeFind query # should be called whenever rawQuery is modified. @updateQuery: -> diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 8f53282b..8a5114cd 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -641,7 +641,8 @@ window.handleEnterForFindMode = -> # :options is an optional dict. valid parameters are 'caseSensitive' and 'backwards'. window.executeFind = (query, options) -> result = null - options = options || {} + options = extend {backwards: false, caseSensitive: !findModeQuery.ignoreCase}, options + query ?= FindMode.getQuery options.backwards document.body.classList.add("vimiumFindMode") @@ -679,10 +680,8 @@ selectFoundInputElement = -> findAndFocus = (backwards) -> Marks.setPreviousPosition() - query = FindMode.getQuery backwards - window.findModeQuery.hasResults = - executeFind(query, { backwards: backwards, caseSensitive: !findModeQuery.ignoreCase }) + executeFind null, {backwards} if findModeQuery.hasResults focusFoundLink() -- cgit v1.2.3