diff --git a/packages/tui/src/components/markdown.ts b/packages/tui/src/components/markdown.ts index 0f8ffdfe9..8e23e2890 100644 --- a/packages/tui/src/components/markdown.ts +++ b/packages/tui/src/components/markdown.ts @@ -145,7 +145,9 @@ export class Markdown implements Component { const token = tokens[i]; const nextToken = tokens[i + 1]; const tokenLines = this.renderToken(token, contentWidth, nextToken?.type); - renderedLines.push(...tokenLines); + for (const tokenLine of tokenLines) { + renderedLines.push(tokenLine); + } } // Wrap lines (NO padding, NO background yet) @@ -154,7 +156,9 @@ export class Markdown implements Component { if (isImageLine(line)) { wrappedLines.push(line); } else { - wrappedLines.push(...wrapTextWithAnsi(line, contentWidth)); + for (const wrappedLine of wrapTextWithAnsi(line, contentWidth)) { + wrappedLines.push(wrappedLine); + } } } @@ -191,7 +195,7 @@ export class Markdown implements Component { } // Combine top padding, content, and bottom padding - const result = [...emptyLines, ...contentLines, ...emptyLines]; + const result = emptyLines.concat(contentLines, emptyLines); // Update cache this.cachedText = this.text;