diff options
| author | mrmr1993 | 2015-05-20 16:58:42 +0100 |
|---|---|---|
| committer | mrmr1993 | 2015-05-20 16:58:42 +0100 |
| commit | 59f9bb28dd145d04de0b042580b49dfa13de3ae5 (patch) | |
| tree | c1a6ea05351dd6db18ca61e0809b1345257f74c2 /content_scripts | |
| parent | 0ac2cf831592d08c7cd42b6f0ea6bfae6fb926b6 (diff) | |
| download | vimium-59f9bb28dd145d04de0b042580b49dfa13de3ae5.tar.bz2 | |
Only replace double-slashes in find mode if they precede our flags
This fixes #1673
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) |
