improved single list command line performance by batching appends

This commit is contained in:
typer 2020-11-28 19:27:54 -08:00
parent b34ed3f22b
commit 24828801da

View file

@ -2023,14 +2023,15 @@ function updateSuggestedCommands() {
function displayFoundCommands() {
$("#commandLine .suggestions").empty();
let commandsHTML = "";
let list = currentCommands[currentCommands.length - 1];
$.each(list.list, (index, obj) => {
if (obj.found && (obj.available !== undefined ? obj.available() : true)) {
$("#commandLine .suggestions").append(
'<div class="entry" command="' + obj.id + '">' + obj.display + "</div>"
);
commandsHTML +=
'<div class="entry" command="' + obj.id + '">' + obj.display + "</div>";
}
});
$("#commandLine .suggestions").html(commandsHTML);
if ($("#commandLine .suggestions .entry").length == 0) {
$("#commandLine .separator").css({ height: 0, margin: 0 });
} else {