aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--background_scripts/completion.coffee2
-rw-r--r--content_scripts/vimium_frontend.coffee2
-rw-r--r--lib/utils.coffee3
3 files changed, 5 insertions, 2 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 951d0756..fd41cdc8 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -356,7 +356,7 @@ RegexpCache =
regexpString = prefix + regexpString if prefix
regexpString = regexpString + suffix if suffix
# Smartcase: Regexp is case insensitive, unless `string` contains a capital letter (testing `string`, not `regexpString`).
- @cache[regexpString] ||= new RegExp regexpString, (if /[A-Z]/.test string then "" else "i")
+ @cache[regexpString] ||= new RegExp regexpString, (if Utils.hasUpperCase(string) then "" else "i")
# Provides cached access to Chrome's history. As the user browses to new pages, we add those pages to this
# history cache.
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index a869e0ed..ca7af5ae 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -536,7 +536,7 @@ updateFindModeQuery = ->
return match
# default to 'smartcase' mode, unless noIgnoreCase is explicitly specified
- findModeQuery.ignoreCase = !hasNoIgnoreCaseFlag && !/[A-Z]/.test(findModeQuery.parsedQuery)
+ findModeQuery.ignoreCase = !hasNoIgnoreCaseFlag && !Utils.hasUpperCase(findModeQuery.parsedQuery)
# if we are dealing with a regex, grep for all matches in the text, and then call window.find() on them
# sequentially so the browser handles the scrolling / text selection.
diff --git a/lib/utils.coffee b/lib/utils.coffee
index 6f84d008..9e15dcc0 100644
--- a/lib/utils.coffee
+++ b/lib/utils.coffee
@@ -133,6 +133,9 @@ Utils =
zip: (arrays) ->
arrays[0].map (_,i) ->
arrays.map( (array) -> array[i] )
+
+ # locale-sensitive uppercase detection
+ hasUpperCase: (s) -> s.toLowerCase() != s
# This creates a new function out of an existing function, where the new function takes fewer arguments. This
# allows us to pass around functions instead of functions + a partial list of arguments.