修复右侧边栏“差异”区域统计的行数不正确

This commit is contained in:
xintaofei
2026-03-28 15:07:23 +08:00
parent f893d9ff24
commit cb1c7211ef

View File

@@ -1,5 +1,6 @@
import type { MessageTurn } from "./types"
import { normalizeToolName } from "./tool-call-normalization"
import { estimateChangedLineStats } from "./line-change-stats"
import { generateUnifiedDiff } from "./unified-diff-generator"
export type FileOperation = "read" | "edit" | "write" | "apply_patch"
@@ -626,8 +627,12 @@ function computeLineDiff(
continue
}
additions += countLines(change.newText)
deletions += countLines(change.oldText)
const estimated = estimateChangedLineStats(
change.oldText,
change.newText
)
additions += estimated.additions
deletions += estimated.deletions
}
return { additions, deletions }
@@ -643,10 +648,7 @@ function computeLineDiff(
if (!oldStr && !newStr) return null
return {
additions: countLines(newStr),
deletions: countLines(oldStr),
}
return estimateChangedLineStats(oldStr, newStr)
}
if (op === "write") {