From 0450bec1a279e8d67ea46950397f1de91b1b118c Mon Sep 17 00:00:00 2001 From: mrmr1993 Date: Sat, 19 Apr 2014 01:46:22 +0100 Subject: Add a comment explaining match counting for string searches --- content_scripts/vimium_frontend.coffee | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'content_scripts') diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 5ba6fa45..c7cff961 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -555,8 +555,11 @@ updateFindModeQuery = -> findModeQuery.regexMatches = text.match(pattern) findModeQuery.activeRegexIndex = 0 findModeQuery.matchCount = findModeQuery.regexMatches?.length + # if we are doing a basic plain string match, we still want to grep for matches of the string, so we can + # show a the number of results. We can grep on document.body.innerText, as it should be indistinguishable + # from the internal representation used by window.find. else - # escape all special characters, so RegExp just parses the string + # escape all special characters, so RegExp just parses the string 'as is'. parsedNonRegexQuery = findModeQuery.parsedQuery.replace("\\", "\\\\") .replace("^", "\\^") .replace("$", "\\$") -- cgit v1.2.3