mirror of
https://github.com/microsoft/vscode.git
synced 2026-05-08 09:08:48 +01:00
don't rerender the same output
This commit is contained in:
@@ -281,8 +281,6 @@ function renderStream(outputInfo: OutputWithAppend, outputElement: HTMLElement,
|
||||
|
||||
outputElement.classList.add('output-stream');
|
||||
|
||||
|
||||
|
||||
const scrollTop = outputScrolling ? findScrolledHeight(outputElement) : undefined;
|
||||
|
||||
const previousOutputParent = getPreviousMatchingContentGroup(outputElement);
|
||||
@@ -302,8 +300,9 @@ function renderStream(outputInfo: OutputWithAppend, outputElement: HTMLElement,
|
||||
const existingContent = outputElement.querySelector(`[output-item-id="${outputInfo.id}"]`) as HTMLElement | null;
|
||||
let contentParent = existingContent?.parentElement;
|
||||
if (existingContent && contentParent) {
|
||||
if (appendedText) {
|
||||
appendOutput(existingContent, outputInfo.id, appendedText, ctx.settings.lineLimit, outputScrolling, false);
|
||||
// appending output only in scrollable ouputs currently
|
||||
if (appendedText && outputScrolling) {
|
||||
appendOutput(existingContent, appendedText, false);
|
||||
}
|
||||
else {
|
||||
const newContent = createContent(outputInfo, ctx, outputScrolling, error);
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user