mirror of
https://github.com/badlogic/pi-mono.git
synced 2026-11-05 23:37:25 +00:00
fix(tui): Make markdown.ts more robust to large markdown files (#4463)
This commit is contained in:
parent
f2b105dd56
commit
8da1f3d131
1 changed files with 7 additions and 3 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue