aboutsummaryrefslogtreecommitdiffstats
path: root/background_scripts/completion.coffee
diff options
context:
space:
mode:
authorJez Ng2012-12-16 12:00:29 -0800
committerJez Ng2012-12-16 12:00:29 -0800
commit6eca29f7a6b10b923bedd10fedb1cf4a032b0392 (patch)
treedb1d83ce17f433ceaf30ac25363dcff335fcb40f /background_scripts/completion.coffee
parentb7ac8b14da25232d2306ffe51e4bf789ff8ea295 (diff)
parent049cf4314fc2e97e0f5b09cd8a8d066e2c04eb8a (diff)
downloadvimium-6eca29f7a6b10b923bedd10fedb1cf4a032b0392.tar.bz2
Merge pull request #721 from smblott-github/smartcase
Use smartcase for vomnibar queries.
Diffstat (limited to 'background_scripts/completion.coffee')
-rw-r--r--background_scripts/completion.coffee3
1 files changed, 2 insertions, 1 deletions
diff --git a/background_scripts/completion.coffee b/background_scripts/completion.coffee
index 28bb1afa..951d0756 100644
--- a/background_scripts/completion.coffee
+++ b/background_scripts/completion.coffee
@@ -355,7 +355,8 @@ RegexpCache =
# Avoid cost of constructing new strings if prefix/suffix are empty (which is expected to be a common case).
regexpString = prefix + regexpString if prefix
regexpString = regexpString + suffix if suffix
- @cache[regexpString] ||= new RegExp(regexpString, "i")
+ # 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")
# Provides cached access to Chrome's history. As the user browses to new pages, we add those pages to this
# history cache.