aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJez Ng2012-09-10 16:34:13 -0400
committerJez Ng2012-09-10 16:48:50 -0400
commit4314fb7b1ff2e8e68c2a56e6e8e004ead63c53a5 (patch)
tree9977fed464b1490010ee5eae2c9b19970079e756
parent99afbfc0018d078959e7bf36352771d9e9206338 (diff)
downloadvimium-4314fb7b1ff2e8e68c2a56e6e8e004ead63c53a5.tar.bz2
Add option to make regex find the default. Closes #569.
-rw-r--r--content_scripts/vimium_frontend.coffee8
-rw-r--r--options/options.coffee2
-rw-r--r--options/options.html14
3 files changed, 21 insertions, 3 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 22070084..2f30d47a 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -43,7 +43,8 @@ settings =
values: {}
loadedValues: 0
valuesToLoad: ["scrollStepSize", "linkHintCharacters", "filterLinkHints", "hideHud", "previousPatterns",
- "nextPatterns", "findModeRawQuery", "userDefinedLinkHintCss", "helpDialog_showAdvancedCommands"]
+ "nextPatterns", "findModeRawQuery", "regexFindMode", "userDefinedLinkHintCss",
+ "helpDialog_showAdvancedCommands"]
isLoaded: false
eventListeners: {}
@@ -572,13 +573,16 @@ updateFindModeQuery = ->
# the query can be treated differently (e.g. as a plain string versus regex depending on the presence of
# escape sequences. '\' is the escape character and needs to be escaped itself to be used as a normal
# character. here we grep for the relevant escape sequences.
- findModeQuery.isRegex = false
+ findModeQuery.isRegex = settings.get 'regexFindMode'
hasNoIgnoreCaseFlag = false
findModeQuery.parsedQuery = findModeQuery.rawQuery.replace /\\./g, (match) ->
switch (match)
when "\\r"
findModeQuery.isRegex = true
return ""
+ when "\\R"
+ findModeQuery.isRegex = false
+ return ""
when "\\I"
hasNoIgnoreCaseFlag = true
return ""
diff --git a/options/options.coffee b/options/options.coffee
index ffa6bc44..27b08e38 100644
--- a/options/options.coffee
+++ b/options/options.coffee
@@ -3,7 +3,7 @@ $ = (id) -> document.getElementById id
bgSettings = chrome.extension.getBackgroundPage().Settings
editableFields = ["scrollStepSize", "excludedUrls", "linkHintCharacters", "userDefinedLinkHintCss",
- "keyMappings", "filterLinkHints", "previousPatterns", "nextPatterns", "hideHud"]
+ "keyMappings", "filterLinkHints", "previousPatterns", "nextPatterns", "hideHud", "regexFindMode"]
canBeEmptyFields = ["excludedUrls", "keyMappings", "userDefinedLinkHintCss"]
diff --git a/options/options.html b/options/options.html
index 089de394..d7851c75 100644
--- a/options/options.html
+++ b/options/options.html
@@ -272,6 +272,20 @@ unmapAll
</td>
</tr>
<tr class="advancedOption">
+ <td class="caption"></td>
+ <td verticalAlign="top" class="booleanOption">
+ <div class="help">
+ <div class="example">
+ Switch back to plain find mode by using the <code>\R</code> escape sequence.
+ </div>
+ </div>
+ <label>
+ <input id="regexFindMode" type="checkbox"/>
+ Treat find queries as regular expressions.
+ </label>
+ </td>
+ </tr>
+ <tr class="advancedOption">
<td class="caption">Previous Patterns</td>
<td verticalAlign="top">
<div class="help">