mirror of
https://github.com/RooVetGit/Roo-Code.git
synced 2026-08-28 05:27:24 +00:00
insert_content: align right buffer newline with display-normalized left to prevent false deletion at EOF append
This commit is contained in:
parent
a398b578ea
commit
2b4a614260
1 changed files with 5 additions and 2 deletions
|
|
@ -175,8 +175,11 @@ export class DiffViewProvider {
|
|||
await vscode.workspace.applyEdit(edit)
|
||||
}
|
||||
|
||||
// Preserve empty last line if original content had one.
|
||||
const hasEmptyLastLine = this.originalContent?.endsWith("\n")
|
||||
// Preserve empty last line if the ORIGINAL DISPLAY BUFFER had one.
|
||||
// We normalize the left side (original) to include a trailing newline for display
|
||||
// when the file lacks it. To avoid spurious deletion on EOF-append, keep the
|
||||
// right side consistent with that display buffer as well.
|
||||
const hasEmptyLastLine = (this.originalContentForDisplay ?? this.originalContent)?.endsWith("\n")
|
||||
|
||||
if (hasEmptyLastLine && !accumulatedContent.endsWith("\n")) {
|
||||
accumulatedContent += "\n"
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue