diff --git a/common/content/completion.js b/common/content/completion.js index 1f7d7ffd..5ad4f13f 100644 --- a/common/content/completion.js +++ b/common/content/completion.js @@ -373,37 +373,20 @@ CompletionContext.prototype = { { this.hasItems = true; this._generate = arg; - //**/ liberator.dump(this.name + ": set generate()"); if (this.background && this.regenerate) { - //**/ this.__i = (this.__i || 0) + 1; - //**/ let self = this; - //**/ function dump(msg) liberator.callInMainThread(function () liberator.dump(self.name + ":" + self.__i + ": " + msg)); - //**/ dump("set generate() regenerating"); - let lock = {}; this.cache.backgroundLock = lock; this.incomplete = true; let thread = this.getCache("backgroundThread", liberator.newThread); - //**/ dump(thread); liberator.callAsync(thread, this, function () { - //**/ dump("In async"); if (this.cache.backgroundLock != lock) - { - //**/ dump("Lock !ok"); return; - } let items = this.generate(); - //**/ dump("Generated"); if (this.cache.backgroundLock != lock) - { - //**/ dump("Lock !ok"); return; - } this.incomplete = false; - //**/ dump("completions="); this.completions = items; - //**/ dump("completions=="); }); } }, @@ -1124,11 +1107,12 @@ function Completion() //{{{ // Constants are unsorted, and appear before other non-null strings. // Other strings are sorted in the default manner. let compare = context.compare; + function isnan(item) item != '' && isNaN(item); context.compare = function (a, b) { - if (!isNaN(a.item.key) && !isNaN(b.item.key)) + if (!isnan(a.item.key) && !isnan(b.item.key)) return a.item.key - b.item.key; - return isNaN(b.item.key) - isNaN(a.item.key) || compare(a.item.key, b.item.key); + return isnan(b.item.key) - isnan(a.item.key) || compare(a, b); } if (!context.anchored) // We've already listed anchored matches, so don't list them again here. context.filters.push(function (item) util.compareIgnoreCase(item.text.substr(0, this.filter.length), this.filter)); diff --git a/common/content/ui.js b/common/content/ui.js index 4ad8e67b..02b1db3d 100644 --- a/common/content/ui.js +++ b/common/content/ui.js @@ -1743,6 +1743,8 @@ function ItemList(id) //{{{ ////////////////////// PRIVATE SECTION ///////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////{{{ + const WAITING_MESSAGE = "Generating results..."; + var completionElements = []; var iframe = document.getElementById(id); @@ -1817,7 +1819,7 @@ function ItemList(id) //{{{
-
Waiting...
+
{WAITING_MESSAGE}
, context.cache.nodes); divNodes.completions.appendChild(context.cache.nodes.root); @@ -1848,13 +1850,13 @@ function ItemList(id) //{{{ function getRows(context) { function fix(n) util.Math.constrain(n, 0, len); - end -= !!context.message + context.incomplete; let len = context.items.length; let start = off; + end -= !!context.message + context.incomplete; off += len; - let res = [fix(offset - start), fix(end - start)]; - res[2] = (context.incomplete && res[1] >= offset && off - 1 < end); - return res; + + let s = fix(offset - start), e = fix(end - start); + return [s, e, context.incomplete && e >= offset && off - 1 < end]; } items.contextList.forEach(function fill_eachContext(context) {