aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStephen Blott2015-05-20 20:29:22 +0100
committerStephen Blott2015-05-20 20:29:22 +0100
commit980f03c4250c87e64535ff4964f9c8cd45fa80bf (patch)
tree0c4f5ae7b77a4af7074fe6c11831b9b2f69ae21c
parent0ac2cf831592d08c7cd42b6f0ea6bfae6fb926b6 (diff)
parent71b4d21af502bfbb914740c59fc9fb5d0f4957b0 (diff)
downloadvimium-980f03c4250c87e64535ff4964f9c8cd45fa80bf.tar.bz2
Merge pull request #1674 from mrmr1993/only-escape-double-slashes-for-our-flags
Only replace double-slashes in find mode if they precede our flags
-rw-r--r--content_scripts/vimium_frontend.coffee19
1 files changed, 7 insertions, 12 deletions
diff --git a/content_scripts/vimium_frontend.coffee b/content_scripts/vimium_frontend.coffee
index 7e0416aa..41fb772b 100644
--- a/content_scripts/vimium_frontend.coffee
+++ b/content_scripts/vimium_frontend.coffee
@@ -718,21 +718,16 @@ 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.parsedQuery = findModeQuery.rawQuery.replace /(\\{1,2})([rRI]?)/g, (match, slashes, flag) ->
+ return match if flag == "" or slashes.length != 1
+ switch (flag)
+ when "r"
findModeQuery.isRegex = true
- return ""
- when "\\R"
+ when "R"
findModeQuery.isRegex = false
- return ""
- when "\\I"
+ when "I"
hasNoIgnoreCaseFlag = true
- return ""
- when "\\\\"
- return "\\"
- else
- return match
+ ""
# default to 'smartcase' mode, unless noIgnoreCase is explicitly specified
findModeQuery.ignoreCase = !hasNoIgnoreCaseFlag && !Utils.hasUpperCase(findModeQuery.parsedQuery)