diff --git a/src/tools/utils/editorOperationUtils.ts b/src/tools/utils/editorOperationUtils.ts index 4c4db1a..08f71c9 100644 --- a/src/tools/utils/editorOperationUtils.ts +++ b/src/tools/utils/editorOperationUtils.ts @@ -51,7 +51,7 @@ function tryIgnoreLockedCodeTextForOperation ( const splitText: string[] = [] const uneditableRangesText = uneditableRangesInOperationRange.map(range => model.getValueInRange(range)) let currentRange: number = 0 - let remainingText: string = normalizeStringLineBreaks(operationText) + let remainingText: string = normalizeStringLineBreaks(operationText, model.getEOL()) while (remainingText.length > 0 && currentRange < uneditableRangesText.length) { const rangeText = uneditableRangesText[currentRange] if (rangeText != null && rangeText !== '') { diff --git a/src/tools/utils/stringUtils.ts b/src/tools/utils/stringUtils.ts index 7091cb0..ef235c2 100644 --- a/src/tools/utils/stringUtils.ts +++ b/src/tools/utils/stringUtils.ts @@ -1,3 +1,3 @@ -export function normalizeStringLineBreaks (str: string, lineBreakCharacter: string = '\n'): string { - return str.replaceAll(/\r?\n|\r/g, lineBreakCharacter) +export function normalizeStringLineBreaks (str: string, lineBreakCharacter: string): string { + return str.replace(/\r\n|\r|\n/g, lineBreakCharacter) }