1
0
mirror of https://github.com/gryf/pentadactyl-pm.git synced 2026-01-08 21:14:13 +01:00

Bang on tests some more. Ameliorate some async completion issues.

--HG--
extra : rebase_source : 0f550b1650963e4010e447db2df7d6815627bae2
This commit is contained in:
Kris Maglione
2011-02-01 04:02:29 -05:00
parent e38f408b5d
commit a21db1858a
7 changed files with 174 additions and 107 deletions

View File

@@ -798,14 +798,14 @@ var CompletionContext = Class("CompletionContext", {
/**
* Wait for all subcontexts to complete.
*
* @param {boolean} interruptible When true, the call may be interrupted
* via <C-c>, in which case, "Interrupted" may be thrown.
* @param {number} timeout The maximum time, in milliseconds, to wait.
* If 0 or null, wait indefinitely.
* @param {boolean} interruptible When true, the call may be interrupted
* via <C-c>, in which case, "Interrupted" may be thrown.
*/
wait: function wait(interruptable, timeout) {
util.waitFor(function () !this.incomplete, this, timeout);
return this.incomplete;
wait: function wait(timeout, interruptable) {
this.allItems;
return util.waitFor(function () !this.incomplete, this, timeout, interruptable);
}
}, {
Sort: {
@@ -852,7 +852,7 @@ var Completion = Module("completion", {
return { items: res.map(function (i) ({ item: i })) };
context.contexts["/run"].completions = res;
}
context.wait(true);
context.wait(null, true);
return context.allItems;
},
@@ -866,7 +866,7 @@ var Completion = Module("completion", {
context.maxItems = maxItems;
context.fork.apply(context, ["list", 0, this, name].concat(Array.slice(arguments, 3)));
context = context.contexts["/list"];
context.wait();
context.wait(null, true);
let contexts = context.contextList.filter(function (c) c.hasItems && c.items.length);
if (!contexts.length)