fix(ui): preserve new line at the end of edit window (#27057)

This commit is contained in:
Dev Randalpura
2026-05-14 14:33:41 -04:00
committed by GitHub
parent 456d1aec74
commit 6fee663ddc
2 changed files with 48 additions and 8 deletions
+12 -8
View File
@@ -202,15 +202,19 @@ async function calculateFlexibleReplacement(
const indentationMatch = firstLineInMatch.match(/^([ \t]*)/);
const indentation = indentationMatch ? indentationMatch[1] : '';
const newBlockWithIndent = applyIndentation(replaceLines, indentation);
sourceLines.splice(
i,
searchLinesStripped.length,
newBlockWithIndent.join('\n'),
);
i += replaceLines.length;
} else {
i++;
let replacementText = newBlockWithIndent.join('\n');
if (
new_string !== '' &&
window[window.length - 1].endsWith('\n') &&
!replacementText.endsWith('\n')
) {
replacementText += '\n';
}
sourceLines.splice(i, searchLinesStripped.length, replacementText);
}
i++;
}
if (flexibleOccurrences > 0) {