Skip to content

Commit 003bb5c

Browse files
committed
fix diffview for search-and-replace tool and insert tool
1 parent eef34c0 commit 003bb5c

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/core/Cline.ts

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1573,11 +1573,7 @@ export class Cline {
15731573
await delay(200)
15741574
}
15751575

1576-
const diff = formatResponse.createPrettyPatch(
1577-
relPath,
1578-
this.diffViewProvider.originalContent,
1579-
updatedContent,
1580-
)
1576+
const diff = formatResponse.createPrettyPatch(relPath, fileContent, updatedContent)
15811577

15821578
if (!diff) {
15831579
pushToolResult(`No changes needed for '${relPath}'`)
@@ -1707,6 +1703,8 @@ export class Cline {
17071703

17081704
// Read the original file content
17091705
const fileContent = await fs.readFile(absolutePath, "utf-8")
1706+
this.diffViewProvider.editType = "modify"
1707+
this.diffViewProvider.originalContent = fileContent
17101708
let lines = fileContent.split("\n")
17111709

17121710
for (const op of parsedOperations) {
@@ -1745,11 +1743,7 @@ export class Cline {
17451743
this.consecutiveMistakeCount = 0
17461744

17471745
// Show diff preview
1748-
const diff = formatResponse.createPrettyPatch(
1749-
relPath,
1750-
this.diffViewProvider.originalContent,
1751-
newContent,
1752-
)
1746+
const diff = formatResponse.createPrettyPatch(relPath, fileContent, newContent)
17531747

17541748
if (!diff) {
17551749
pushToolResult(`No changes needed for '${relPath}'`)

0 commit comments

Comments
 (0)