Skip to content

Commit e8eade2

Browse files
sirzeratorgkatsev
authored andcommitted
Fix a TypeError triggered in completion.js (#456) (#497)
Several features relying on completion lists would stop working or not start at all when hitting this code path
1 parent 68ae0c1 commit e8eade2

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

common/content/completion.js

+11-10
Original file line numberDiff line numberDiff line change
@@ -687,16 +687,17 @@ const Completion = Module("completion", {
687687
context.fork.apply(context, ["list", 0, completion, name].concat(Array.slice(arguments, 3)));
688688
context.wait();
689689

690-
for (let [key, context] in Iterator(context.contexts)) {
691-
if (key.startsWith("/list")) {
692-
let list = template.genericOutput("",
693-
xml`<div highlight="Completions">
694-
${ template.completionRow(context.title, "CompTitle") }
695-
${ template.map2(xml, context.items, function (item) context.createRow(item), null, 100) }
696-
</div>`);
697-
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
698-
}
699-
}
690+
Object.keys(context.contexts)
691+
.filter(k => k.startsWith("/list"))
692+
.forEach(function(k) {
693+
let ctx = context.contexts[k];
694+
let list = template.genericOutput("",
695+
xml`<div highlight="Completions">
696+
${ template.completionRow(ctx.title, "CompTitle") }
697+
${ template.map2(xml, ctx.items, function (item) ctx.createRow(item), null, 100) }
698+
</div>`);
699+
commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE);
700+
});
700701
},
701702

702703
////////////////////////////////////////////////////////////////////////////////

0 commit comments

Comments
 (0)