From 4314fb7b1ff2e8e68c2a56e6e8e004ead63c53a5 Mon Sep 17 00:00:00 2001 From: Jez Ng Date: Mon, 10 Sep 2012 16:34:13 -0400 Subject: Add option to make regex find the default. Closes #569. --- content_scripts/vimium_frontend.coffee | 8 ++++++-- options/options.coffee | 2 +- options/options.html | 14 ++++++++++++++ 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 @@ -271,6 +271,20 @@ unmapAll + + + +
+
+ Switch back to plain find mode by using the \R escape sequence. +
+
+ + + Previous Patterns -- cgit v1.2.3