[Pkg-mozext-commits] [nostalgy] 144/235: new completion mode "Match only the prefix of folder path or name, not any substring" (patch from Laurent Regnier)
David Prévot
taffit at alioth.debian.org
Tue Oct 8 20:42:07 UTC 2013
This is an automated email from the git hooks/post-receive script.
taffit pushed a commit to branch master
in repository nostalgy.
commit bbb40780054a3b9586904816003d30f5a6a905e4
Author: frisch <frisch at 56b81dcf-5a2f-0410-9db0-014be2e416ff>
Date: Sun Dec 14 10:44:29 2008 +0000
new completion mode "Match only the prefix of folder path or name, not any substring" (patch from Laurent Regnier)
git-svn-id: http://nostalgy.googlecode.com/svn/trunk@144 56b81dcf-5a2f-0410-9db0-014be2e416ff
---
CHANGES | 1 +
content/edit_prefs.xul | 2 ++
content/folders.js | 12 ++++++++++--
3 files changed, 13 insertions(+), 2 deletions(-)
diff --git a/CHANGES b/CHANGES
index 06d6edd..5fcfe1f 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,6 +1,7 @@
Since 0.2.16
- fix bugs with TB 3
- allow it to run with TB 3.0b1
+ - new completion mode "Match only the prefix of folder path or name, not any substring" (patch from Laurent Regnier)
0.2.16
- allow it to run with TB 3.0
diff --git a/content/edit_prefs.xul b/content/edit_prefs.xul
index 2efd64b..58cfc41 100644
--- a/content/edit_prefs.xul
+++ b/content/edit_prefs.xul
@@ -71,6 +71,8 @@ shortcuts to move/copy the message to this folder.</label>
id="restrict_to_current_server" accesskey="R"/>
<checkbox label="Match only on folder name, not on the full path"
id="match_only_folder_name" accesskey="P"/>
+ <checkbox label="Match only the prefix of folder path or name, not any substring"
+ id="match_only_prefix" accesskey="B"/>
<checkbox label="Sort folders alphabetically"
id="sort_folders" accesskey="S"/>
<checkbox label="Match folder names in a case sensitive way"
diff --git a/content/folders.js b/content/folders.js
index c4cac7f..7612f73 100644
--- a/content/folders.js
+++ b/content/folders.js
@@ -1,6 +1,7 @@
var nostalgy_completion_options = {
restrict_to_current_server : false,
match_only_folder_name : false,
+ match_only_prefix : false,
sort_folders : false,
match_case_sensitive : false,
tab_shell_completion : false,
@@ -70,6 +71,13 @@ function mayLowerCase(s) {
return s;
}
+function mayMatchOnlyPrefix(s, reg) {
+ if (nostalgy_completion_options.match_only_prefix)
+ return mayLowerCase(s).search(reg) == 0;
+ else
+ return mayLowerCase(s).match(reg);
+}
+
function full_folder_name(folder) {
if (folder.tag) return (":" + folder.tag);
var uri = folder.prettyName;
@@ -119,10 +127,10 @@ function LongestCommonPrefix(s1,s2) {
function NostalgyFolderMatch(f,reg) {
if (nostalgy_completion_options.match_only_folder_name) {
- return (mayLowerCase(nostalgy_prettyName(f)).match(reg) ||
+ return (mayMatchOnlyPrefix(nostalgy_prettyName(f), reg) ||
mayLowerCase(folder_name(f)).search(reg) == 0);
} else {
- return (mayLowerCase(folder_name(f)).match(reg));
+ return mayMatchOnlyPrefix(folder_name(f), reg);
}
}
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-mozext/nostalgy.git
More information about the Pkg-mozext-commits
mailing list