mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-09-05 08:10:14 +00:00
diff view: normalize original buffer EOLs and force trailing newline for display; should remove single-line deletion in insert_content EOF append
This commit is contained in:
parent
2b4a614260
commit
494fc951ed
1 changed files with 4 additions and 4 deletions
|
|
@ -72,10 +72,10 @@ export class DiffViewProvider {
|
|||
|
||||
if (fileExists) {
|
||||
this.originalContent = await fs.readFile(absolutePath, "utf-8")
|
||||
// Normalize trailing newline for display only to avoid false replace of last line
|
||||
this.originalContentForDisplay = this.originalContent.endsWith("\n")
|
||||
? this.originalContent
|
||||
: this.originalContent + "\n"
|
||||
// Normalize EOLs to \n for display and ensure a trailing newline so
|
||||
// the last unchanged line is treated as context instead of a replace.
|
||||
const normalizedEol = this.originalContent.replace(/\r\n/g, "\n")
|
||||
this.originalContentForDisplay = normalizedEol.endsWith("\n") ? normalizedEol : normalizedEol + "\n"
|
||||
} else {
|
||||
this.originalContent = ""
|
||||
// For new files, keep original empty to show all additions
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue