Skip to content

Commit 1f6d6d8

Browse files
committed
feat(diffViewProvider): trim end of normalized content to prevent trailing whitespace in user edit comparison
1 parent 491206c commit 1f6d6d8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/integrations/editor/DiffViewProvider.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -226,10 +226,10 @@ export class DiffViewProvider {
226226
const newContentEOL = this.newContent.includes("\r\n") ? "\r\n" : "\n"
227227

228228
// Normalize EOL characters without trimming content
229-
const normalizedEditedContent = editedContent.replace(/\r\n|\n/g, newContentEOL)
229+
const normalizedEditedContent = editedContent.replace(/\r\n|\n/g, newContentEOL).trimEnd()
230230

231231
// Just in case the new content has a mix of varying EOL characters.
232-
const normalizedNewContent = this.newContent.replace(/\r\n|\n/g, newContentEOL)
232+
const normalizedNewContent = this.newContent.replace(/\r\n|\n/g, newContentEOL).trimEnd()
233233

234234
if (normalizedEditedContent !== normalizedNewContent) {
235235
// User made changes before approving edit.

0 commit comments

Comments
 (0)