修复右侧边栏“差异”区域统计的行数不正确
This commit is contained in:
@@ -1,5 +1,6 @@
|
|||||||
import type { MessageTurn } from "./types"
|
import type { MessageTurn } from "./types"
|
||||||
import { normalizeToolName } from "./tool-call-normalization"
|
import { normalizeToolName } from "./tool-call-normalization"
|
||||||
|
import { estimateChangedLineStats } from "./line-change-stats"
|
||||||
import { generateUnifiedDiff } from "./unified-diff-generator"
|
import { generateUnifiedDiff } from "./unified-diff-generator"
|
||||||
|
|
||||||
export type FileOperation = "read" | "edit" | "write" | "apply_patch"
|
export type FileOperation = "read" | "edit" | "write" | "apply_patch"
|
||||||
@@ -626,8 +627,12 @@ function computeLineDiff(
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
additions += countLines(change.newText)
|
const estimated = estimateChangedLineStats(
|
||||||
deletions += countLines(change.oldText)
|
change.oldText,
|
||||||
|
change.newText
|
||||||
|
)
|
||||||
|
additions += estimated.additions
|
||||||
|
deletions += estimated.deletions
|
||||||
}
|
}
|
||||||
|
|
||||||
return { additions, deletions }
|
return { additions, deletions }
|
||||||
@@ -643,10 +648,7 @@ function computeLineDiff(
|
|||||||
|
|
||||||
if (!oldStr && !newStr) return null
|
if (!oldStr && !newStr) return null
|
||||||
|
|
||||||
return {
|
return estimateChangedLineStats(oldStr, newStr)
|
||||||
additions: countLines(newStr),
|
|
||||||
deletions: countLines(oldStr),
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (op === "write") {
|
if (op === "write") {
|
||||||
|
|||||||
Reference in New Issue
Block a user