From fa2b37fa00df88b6f09ddfbb7fd7ecdb03c7ab19 Mon Sep 17 00:00:00 2001 From: Doug Kearns Date: Thu, 20 Sep 2007 13:08:20 +0000 Subject: [PATCH] process link text only find modifiers \[uU] before looking for capitalized letters when 'smartcase' is set --- chrome/content/vimperator/find.js | 29 ++++++++++++++++------------- 1 file 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 case-sensitive modifiers + pattern = pattern.replace(/(\\)?\\[cC]/g, function($0, $1) { return $1 ? $0 : "" }); - // strip modifiers - pattern = pattern.replace(/(\\)?\\[cCuU]/g, function($0, $1) { return $1 ? $0 : "" }); - - // remove the modifer escape \ + // remove any modifer escape \ pattern = pattern.replace(/\\(\\[cCuU])/g, '$1') search_string = pattern;