don't rerender the same output

This commit is contained in:
Aaron Munger
2023-07-12 11:30:58 -07:00
parent 4c2df56f98
commit 77a8acf719
3 changed files with 12 additions and 31 deletions

View File

@@ -111,32 +111,8 @@ export function createOutputContent(id: string, outputText: string, linesLimit:
}
}
export function appendOutput(element: HTMLElement, id: string, outputText: string, linesLimit: number, scrollable: boolean, trustHtml: boolean) {
export function appendOutput(element: HTMLElement, outputText: string, trustHtml: boolean) {
const buffer = outputText.split(/\r\n|\r|\n/g);
let newContent: HTMLDivElement;
if (scrollable) {
newContent = scrollableArrayOfString(id, buffer, trustHtml);
element.appendChild(newContent);
// contains 1 span per line
// const innerContainer = element.childNodes[0].childNodes[0];
// const linesToAdd = newContent.childNodes[0].childNodes[0].childNodes;
// linesToAdd.forEach(span => {
// innerContainer.appendChild(span);
// while (innerContainer.childNodes.length > 5000) {
// innerContainer.firstChild?.remove();
// }
// });
} else {
newContent = truncatedArrayOfString(id, buffer, linesLimit, trustHtml);
// contains 1 span per line
const innerContainer = element.childNodes[0].childNodes[0];
const linesToAdd = newContent.childNodes[0].childNodes[0].childNodes;
linesToAdd.forEach(span => {
innerContainer.appendChild(span);
});
}
const newContent = handleANSIOutput(buffer.join('\n'), trustHtml);
element.appendChild(newContent);
}