Skip to content

Commit

Permalink
fix: use model EOL
Browse files Browse the repository at this point in the history
  • Loading branch information
Loïc Mangeonjean committed Dec 13, 2024
1 parent 8a29234 commit 5da9691
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/tools/utils/editorOperationUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 !== '') {
Expand Down
4 changes: 2 additions & 2 deletions src/tools/utils/stringUtils.ts
Original file line number Diff line number Diff line change
@@ -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)
}

0 comments on commit 5da9691

Please sign in to comment.