diff --git a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx
index 0318ed608..85774067b 100644
--- a/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx
+++ b/gui/src/pages/gui/ToolCallDiv/FindAndReplace.tsx
@@ -68,6 +68,19 @@ function DiffLines({
);
}
+function DiffStats({ added, removed }: { added: number; removed: number }) {
+ if (added === 0 && removed === 0) {
+ return null;
+ }
+
+ return (
+
+ {added > 0 && +{added}}
+ {removed > 0 && -{removed}}
+
+ );
+}
+
export function FindAndReplaceDisplay({
fileUri,
relativeFilePath,
@@ -141,6 +154,30 @@ export function FindAndReplaceDisplay({
}
}, [currentFileContent, edits]);
+ const diffStats = useMemo(() => {
+ if (!diffResult?.diff) {
+ return { added: 0, removed: 0 };
+ }
+
+ let added = 0;
+ let removed = 0;
+
+ diffResult.diff.forEach((part) => {
+ const lines = part.value.split("\n");
+ // Exclude empty line at the end (similar to DiffLines component logic)
+ const lineCount =
+ lines[lines.length - 1] === "" ? lines.length - 1 : lines.length;
+
+ if (part.added) {
+ added += lineCount;
+ } else if (part.removed) {
+ removed += lineCount;
+ }
+ });
+
+ return { added, removed };
+ }, [diffResult?.diff]);
+
const statusIcon = useMemo(() => {
const status = toolCallState?.status;
if (status) {
@@ -174,24 +211,27 @@ export function FindAndReplaceDisplay({
setIsExpanded(!showContent);
}}
>
-
- {statusIcon}
-
-
{
- if (!fileUri) {
- return;
- }
- e.stopPropagation();
- ideMessenger.post("openFile", { path: fileUri });
- }}
- />
+
+
+ {statusIcon}
+
+ {
+ if (!fileUri) {
+ return;
+ }
+ e.stopPropagation();
+ ideMessenger.post("openFile", { path: fileUri });
+ }}
+ />
+
+
{applyState && (
@@ -237,9 +277,7 @@ export function FindAndReplaceDisplay({
}
return renderContainer(
-