From f4613ec8a837298a7d97eb1787d40f2e02a458f8 Mon Sep 17 00:00:00 2001 From: Kris Maglione Date: Mon, 6 Oct 2008 22:06:15 +0000 Subject: [PATCH] Dont lower-case completion strings. --- content/completion.js | 9 ++++----- content/io.js | 3 ++- content/util.js | 5 +++++ 3 files changed, 11 insertions(+), 6 deletions(-) diff --git a/content/completion.js b/content/completion.js index 50561b54..d8e741ae 100644 --- a/content/completion.js +++ b/content/completion.js @@ -95,10 +95,9 @@ liberator.Completion = function () //{{{ : [item[0]]; for (let [,compitem] in Iterator(complist)) { - if (ignorecase) - compitem = String.toLowerCase(compitem); + let str = !ignorecase ? compitem : String(compitem).toLowerCase(); - if (compitem.indexOf(filter) == -1) + if (str.indexOf(filter) == -1) continue; filtered.push([compitem, item[1], favicon ? item[2] : null]); @@ -106,9 +105,9 @@ liberator.Completion = function () //{{{ if (longest) { if (substrings.length == 0) - buildSubstrings(compitem, filter); + buildSubstrings(str, filter); else - substrings = substrings.filter(function (s) compitem.indexOf(s) >= 0); + substrings = substrings.filter(function (s) str.indexOf(s) >= 0); } break; } diff --git a/content/io.js b/content/io.js index 0173ec9e..e6b87c44 100644 --- a/content/io.js +++ b/content/io.js @@ -854,7 +854,8 @@ lookup: catch (e) { let message = "Sourcing file: " + file.path + ": " + e; - Components.utils.reportError(message); + if (Components.utils.reportError) + Components.utils.reportError(message); if (!silent) liberator.echoerr(message); } diff --git a/content/util.js b/content/util.js index a685a7bc..5bf115c7 100644 --- a/content/util.js +++ b/content/util.js @@ -161,6 +161,11 @@ liberator.util = { //{{{ return str.replace(/([\\{}()[\].?*+])/g, "\\$1"); }, + escapeString: function (str) + { + return '"' + str.replace(/([\\'])/g, "\\$1") + '"'; + }, + // Flatten an array: // [["foo", "bar"], ["baz"]] -> ["foo", "bar", "baz"] flatten: function (ary)