fix: patch newline inserts in input

This commit is contained in:
cpacker
2025-11-30 19:47:51 -08:00
parent 25cf92205d
commit b6eee49172
2 changed files with 17 additions and 6 deletions

View File

@@ -25,7 +25,8 @@ export function allocatePaste(content: string): number {
export function resolvePlaceholders(text: string): string {
if (!text) return text;
return text.replace(
// First resolve text placeholders
let result = text.replace(
/\[Pasted text #(\d+) \+(\d+) lines\]/g,
(_match, idStr) => {
const id = Number(idStr);
@@ -33,6 +34,9 @@ export function resolvePlaceholders(text: string): string {
return content !== undefined ? content : _match;
},
);
// Then convert visual newline indicators back to real newlines
result = result.replace(/↵/g, "\n");
return result;
}
export function extractTextPlaceholderIds(text: string): number[] {