diff --git a/content/completion.js b/content/completion.js index b0592bf5..a333abef 100644 --- a/content/completion.js +++ b/content/completion.js @@ -1130,7 +1130,7 @@ function Completion() //{{{ let list = template.generic(
{ template.completionRow(context.title, "CompTitle") } - { template.map(context.items, function (item) context.createRow(item)) } + { template.map(context.items, function (item) context.createRow(item), null, 50) }
); commandline.echo(list, commandline.HL_NORMAL, commandline.FORCE_MULTILINE); }, diff --git a/content/template.js b/content/template.js index 0d86f2b4..3d26df55 100644 --- a/content/template.js +++ b/content/template.js @@ -2,7 +2,7 @@ const template = { add: function add(a, b) a + b, join: function join(c) function (a, b) a + c + b, - map: function map(iter, fn, sep) + map: function map(iter, fn, sep, interruptable) { if (iter.length) /* Kludge? */ iter = util.Array.iterator(iter); @@ -15,6 +15,8 @@ const template = { continue; if (sep && n++) ret += sep; + if (interruptable && n % interruptable == 0) + liberator.threadYield(true, true); ret += val; } return ret;