diff options
Diffstat (limited to 'content_scripts')
| -rw-r--r-- | content_scripts/vimium_frontend.coffee | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee index 7e0416aa..30606b26 100644 --- a/content_scripts/vimium_frontend.coffee +++ b/content_scripts/vimium_frontend.coffee @@ -718,21 +718,19 @@ updateFindModeQuery = -> # character. here we grep for the relevant escape sequences. 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 "" - when "\\\\" - return "\\" - else - return match + findModeQuery.parsedQuery = findModeQuery.rawQuery.replace /(\\{1,2})([rRI])/g, (match, slashes, flag) -> + if slashes.length == 2 + # The escape code is double-escaped (ie. \\r rather than \r). Strip the extra slash. + "\\#{flag}" + else + switch (match) + when "\\r" + findModeQuery.isRegex = true + when "\\R" + findModeQuery.isRegex = false + when "\\I" + hasNoIgnoreCaseFlag = true + "" # default to 'smartcase' mode, unless noIgnoreCase is explicitly specified findModeQuery.ignoreCase = !hasNoIgnoreCaseFlag && !Utils.hasUpperCase(findModeQuery.parsedQuery) |
