summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDoug Kearns <dougkearns@gmail.com>2007-09-20 13:08:20 +0000
committerDoug Kearns <dougkearns@gmail.com>2007-09-20 13:08:20 +0000
commitfa2b37fa00df88b6f09ddfbb7fd7ecdb03c7ab19 (patch)
treea50e39aa1f686faef1df9f1a6a2c1f0ce59dc0ad
parent8049fd3fe743be27f820bcf09d460513675ce037 (diff)
downloadpentadactyl-fa2b37fa00df88b6f09ddfbb7fd7ecdb03c7ab19.tar.gz
process link text only find modifiers \[uU] before looking for capitalized
letters when 'smartcase' is set
-rw-r--r--chrome/content/vimperator/find.js29
1 files changed, 16 insertions, 13 deletions
diff --git a/chrome/content/vimperator/find.js b/chrome/content/vimperator/find.js
index 71fd29c6..e0d83e2f 100644
--- a/chrome/content/vimperator/find.js
+++ b/chrome/content/vimperator/find.js
@@ -70,6 +70,19 @@ function Search() //{{{
search_pattern = pattern;
+ // links only search - \u wins if both modifiers specified
+ if (/\\u/.test(pattern))
+ links_only = false;
+ else if (/\U/.test(pattern))
+ links_only = true;
+ else if (vimperator.options["linksearch"])
+ links_only = true;
+ else
+ links_only = false;
+
+ // strip links-only modifiers
+ pattern = pattern.replace(/(\\)?\\[uU]/g, function($0, $1) { return $1 ? $0 : "" });
+
// case sensitivity - \c wins if both modifiers specified
if (/\c/.test(pattern))
case_sensitive = false;
@@ -82,20 +95,10 @@ function Search() //{{{
else
case_sensitive = true;
- // links only search - \u wins if both modifiers specified
- if (/\\u/.test(pattern))
- links_only = false;
- else if (/\U/.test(pattern))
- links_only = true;
- else if (vimperator.options["linksearch"])
- links_only = true;
- else
- links_only = false;
-
- // strip modifiers
- pattern = pattern.replace(/(\\)?\\[cCuU]/g, function($0, $1) { return $1 ? $0 : "" });
+ // strip case-sensitive modifiers
+ pattern = pattern.replace(/(\\)?\\[cC]/g, function($0, $1) { return $1 ? $0 : "" });
- // remove the modifer escape \
+ // remove any modifer escape \
pattern = pattern.replace(/\\(\\[cCuU])/g, '$1')
search_string = pattern;